Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / March 2005

Tip: Looking for answers? Try searching our database.

Namespace issues in InfoPath output form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matt - 08 Mar 2005 02:37 GMT
Hi,

I'm a newbie at InfoPath, so please forgive me if I ask something dumb.

I have an InfoPath form I created, using an XML file. It works fine, but
when I save the filled-in form, it adds extra stuff in the XML file header.
Specifically, it adds a 'my' namespace, takes the namespace from the input
file and changes it to 'ns1', then sticks 'ns1:' in front of each element in
the output file.

Is there any way to get the output file to look like the input file? I've
looked for settings in the program, but with no success.

Thanks,
Matt
Matt Blank - 08 Mar 2005 23:24 GMT
Hello-
The 'my' namespace is automatically added to the XML file upon
saving... I can't recall why but there is a reason that it does it.
Here is the solution, snipped from http://www.InfoPathDev.com
----------------------
Prevent InfoPath From Autogenerating a Default Namespace Prefix
By Greg Collins, Thursday, October 07, 2004 1:13:41 PM

If you use a custom schema for your InfoPath form that has a target
namespace with no prefix defined, InfoPath will create a default prefix
for you following the pattern of: ns1, ns2, ... nsn. The "ns1" prefix
that InfoPath generates just stands for generic "namespace 1".

Here's what a schema root node looks like that will cause InfoPath to
autogenerate a target namespace prefix:

<xsd:schema targetNamespace="mynamespace"
elementFormDefault="qualified" attributeFormDefault="unqualified"
xmlns="mynamespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

If you do not want InfoPath to autogenerate a prefix, you need to
specify your own target namespace prefix. Let's say you name the prefix
foo; now all of your form elements will be prefixed with foo instead of
ns1. Here's what that schema root node looks like:

<xsd:schema targetNamespace="mynamespace"
elementFormDefault="qualified" attributeFormDefault="unqualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:foo="mynamespace">

If your preference is for your form elements to have no prefix at all,
you need to make sure you don't declare a target namespace. In XML
Schema, it is forbidden to have a prefixless namespace without a target
namespace. So your choice here is to remove completely remove both the
target namespace and the prefixless namespace. Here's what that schema
root node looks like with this change:

<xsd:schema elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
----------------------
Also, the 'ns1:' element tag that it places in front of every tag is
also standard. The group that you create in the data source is what is
appended to the tags. This is a way to view the data source hierarchy
for each tag. If you had two groups above that tag, there would be two
elements in front of the tag (in succession of decending order). This
cannot be eliminated without rearranging the data source to have no
groupings, with all the tags at the main level. You will still recieve
at least one tag from the main group because you cannot eliminate that
main group. Hope this helps.
Matt Blank
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.