What to do when root element is a list?

Hi,
I've been looking at the PurchaseOrder examples and found them really useful and excellent for making a
start at XML DB. However, Ive run into a stumbling block when trying to use my own data
(but i've used the purchase order example below to make illustrating easier).
The problem is rather than have purchase orders in individual XML files,
i have a single file of a few hundred thousand purchase orders inside a parent tag of <PurchaseOrderList>
I can edit the XSD to add the following:
<xs:element name="PurchaseOrderList" xdb:defaultTable="PURCHORDERLIST" xdb:SQLType="PO_LIST_TYPE">
<xs:complexType>
<xs:sequence>
<xs:element name="PurchaseOrder" type="PurchaseOrderType" minOccurs="0" maxOccurs="unbounded" xdb:SQLCollType="PUR_ORDERS"/>
</xs:sequence>
</xs:complexType>
</xs:element>
And remove the line:
<xs:element name="PurchaseOrder" type="PurchaseOrderType" xdb:defaultTable="PURCHASEORDER"/>
And sure enough, i can now load my <PurchaseOrderList> containing all the Purchase orders.
However, I dont really care about the PurchaseOrderList table, its only there because i dont want to have
to break up the list file into the individual entries. But when i load the data like this, as PurchaseOrder is
no longer the root table, I cant work out how to do simple things like select 1 Purchase order document or add
the unique ID constraint etc. (For instance if you load 100 entries in a list and do a select count from the
PURCHORDERLIST table, you get "1", which is correct, but not what Im after).
So, the essence of my question is if I have to load the data where the parent element is there to hold a list
of the "real" documents, how do i design my xsd and subsequent queries to make querying/indexing/retrieving the
data as easy as possible? Ideally I'd like the PurchaseOrder table back & for it to work in an identical way to that in the examples.....
Sorry if I've missed something very basic, but any help would be very gratefully appreciated...
Lee

Continues [http://forums.sun.com/thread.jspa?threadID=5424890]

Similar Messages

  • E4X: What happens to the root element?

    I'm working with XML using the E4X notation. I'm used to the "old school" XML APIs that use DOM and I'm a bit confused.
    For example, let's consider the following XML
    <mx:XML id="myXML" >
      <top>
        <sub1 id="uno">
          <sub2>hello</sub2>
          <sub3>world</sub3>
        </sub1>
        <sub1 id="duo">
          <sub2>ok</sub2>
          <sub3>ko</sub3>
        </sub1>
      </top>
    </mx:XML>
    In my code I use the following traces. This is done with the De MonsterDebugger, but all others should work the same way. I have casted the traces to String only to make it easier to ask this question (no need post images)
    MonsterDebugger.trace(this, "myXML:" + myXML);
    MonsterDebugger.trace(this, "myXML.sub1: " + myXML.sub1);
    MonsterDebugger.trace(this, "myXML.sub1.sub2: " + myXML.sub1.sub2);
    What I get as output is
    (String) = myXML:<top>
      <sub1 id="uno">
        <sub2>hello</sub2>
        <sub3>world</sub3>
      </sub1>
      <sub1 id="duo">
        <sub2>ok</sub2>
        <sub3>ko</sub3>
      </sub1>
    </top>
    (String) = myXML.sub1: <sub1 id="uno">
      <sub2>hello</sub2>
      <sub3>world</sub3>
    </sub1>
    <sub1 id="duo">
      <sub2>ok</sub2>
      <sub3>ko</sub3>
    </sub1>
    (String) = myXML.sub1.sub2: <sub2>hello</sub2>
    <sub2>ok</sub2>
    All is fine above and this was a bit long abstract for my question. The question is what happens to the root element, in this case <top>? I was trying to access the data with the following notation
    myXML.top.sub1; // etc
    I spent quite a lot of time trying to get it to work, until I discovered that the root element is not used. Can anyone explain this?
    Or, I guess the simple explanation is that the root node is ignored and the sub nodes are created as properties of the object. The question also could be stated as: Why isn't this documented in the Flex API Reference?
    Thanks.
    P.S. I found this article on common E4X pitfalls which also has other interesting topics when working with E4X.

    its gone
    downgrading would kill the phone..

  • JDOM "IllegalStateException: Root element not set" when reading file

    Hello, I am relatively new to XML. I am trying to read an xml document to parse some information out of it. I basically have a large amount of data I want to load into my program. I could program it all in as static arrays, but I thought xml would be easier, and make changes easier.
    I am trying to use JDOM, and have the project set up. My problem is when I read the document, it always gives a root element not set exception. Here is my xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
        Contents
    </root>Very basic, I'm using this to get things started. Here is my code for reading it:
            SAXBuilder sb = new SAXBuilder();
            Document d = new Document();
            try {
                sb.build(new File("test1.xml"));
            catch (JDOMException jdome) {
                System.err.println(jdome);
            catch (IOException ioe) {
                System.err.println(ioe);
            d.getContent();Whenever I try to do anything with the contents of the Document, like d.getContent(), it always throws a java.lang.IllegalStateException: Root element not set. It reads the file successfully (as far as I can tell), but it's like the xml file is empty. I can't find anything on the web about this problem, and every tutorial says to do exactly what I've done, but never mention any possible problem. It can find the file, and I can write to an xml file as in other tutorials, but reading one in is a problem.
    I chose JDOM because it seemed simplest for just reading in a large amount of data and parsing it out into variables. This is a very simple project, so I don't want to spend a lot of time writing xml parsing code, I'm only using xml because it will probably be easier than hard coding the data. Would a different xml api be easier to use for my purposes?
    Message was edited by:
    hunter9000

    You must always give the browser an either an absolute URL from the top of
              the web server (not the
              web application) or a relative path from the current page.
              Sam
              "Vijay Kumar" <[email protected]> wrote in message
              news:[email protected]..
              > Hi
              >
              > I get the 'getResource is called when document root is not set.' error
              > when I access any files in the webapp with their absolute path.
              >
              > Environment: WIN/NT SP3, WL5.1 SP5 as the webserver and app server.
              >
              > My webapp located in d:\temp is deployed as foo
              > weblogic.httpd.webApp.foo=d:/temp
              >
              > For example:
              > I can access a file in d:\temp\secured\home.html using
              > test
              >
              > However if with in an html I try to access the file using the abs path
              > from doc root
              > test I get an error
              >
              > and I guess the default servlet looks for the servlet-context named
              > 'secured'
              >
              > Can someone tell me if I can set the documentRoot in the web.xml or
              > weblogic.xml
              > file OR if there is any other way to access to the file using the abs path
              > of /secured/test/test.html
              >
              >
              > Thanks in advance
              >
              > Vijay
              >
              >
              >
              >
              

  • Unable to find root element in XML Schema when Syndicating (SAP MDM)

    Hi experts,
    We are having a problem with our Syndication.
    We have created an XML Schema using XML Spy. We need a namespace, and this is 70 characters long (in other words, far shorter than maximum at 255 characters).
    <xs:schema xmlns:ns="http://schemas.xxxxx.com/ServiceManagement/ServiceMasterDataFromMDM/0.3" xmlns:xs="http://www.xxxxx.org/2001/XMLSchema" targetNamespace="http://schemas.xxxxxx.com/ServiceManagement/ServiceMasterDataFromMDM/0.3" elementFormDefault="unqualified" attributeFormDefault="unqualified">
    When opening the xml schema file in Syndicator, the root field is disabled.
    If we remove namespace in heading of xml schema, the root field is enabled, and the root element is correct.
    How can we make use of the XML schema when we need namespace?
    We have tried to add namespace annotation ns: to all type definitions:
       <xs:element name="ServiceCategory" type="ns:ServiceCategoryType">
    This did not help.
    Please advice.
    KR,
    Thomas
    Edited by: Thomas on Mar 2, 2011 2:12 PM

    >>We need a namespace, and this is 70 characters long
    If you want namespace to appear in XML and your XSD has it too. please add the namespace under "URI" attribute in XML schema in Console.
    You need to import the XSD in Console first, specify namespace under URI and then use this to build syndication map.
    Thanks
    Aamir

  • Xmlns in root element

    When converting exchange rates xml from http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml
    I'm getting problem with xmlns in root element.
    CALL TRANSFORMATION triggers CX_XSLT_ABAP_CALL_ERROR, but only if there is xmlns attribute in first line in input xml:
    <gesmes:Envelope xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" xmlns="http://www.ecb.int/vocabulary/2002-08-01/eurofxref">
    Without this xmlns=.....  (or when modifying e.g. abcxmlns= ) works following xslt fine:
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
      <xsl:strip-space elements="*"/>
      <xsl:template match="/">
        <xsl:copy>
          <xsl:apply-templates/>
        </xsl:copy>
      </xsl:template>
      <xsl:template match="Cube/Cube">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <ROOT2>
              <xsl:value-of select="@time"/>
            </ROOT2>
            <ROOT1>
              <xsl:apply-templates select="Cube"/>
            </ROOT1>
          </asx:values>
        </asx:abap>
      </xsl:template>
      <xsl:template match="Cube/Cube/Cube">
        <loop>
          <AMOUNT>
            <xsl:value-of select="1"/>
          </AMOUNT>
          <CCYCODE>
            <xsl:value-of select="@currency"/>
          </CCYCODE>
          <VALUE>
            <xsl:value-of select="@rate"/>
          </VALUE>
        </loop>
      </xsl:template>
    </xsl:transform>
    I'd appreciate if someone migh advise me how to alternate the xslt or tell me what the xmlns in input does.
    Cheers
    Edited by: Viktor Kunc on Sep 29, 2008 3:25 PM

    If a namespace is specified on root level, it propagates down to all children, see:
    http://www.w3.org/TR/REC-xml-names/scoping
    The namespace is part of a name. So, if you have an element <Cube> as child of the root element <root xmlns="http://www.gesmes.org/xml/2002-08-01">, then
    <xsl:apply-templates select="Cube"/>
    won't be applied, since the qualified name of the element is not Cube but {http://www.gesmes.org/xml/2002-08-01}Cube
    If you want the XSLT to work with and without namespace equally well, you have to work with local names in XPath expressions:
    <xsl:apply-templates select="local-name() = 'Cube'"/>
    The same holds for all XPath functions working with element names.
    Usually, however, the namespace is part of the contract with the client and is
    either obligatory to be used
    or obligatory to be omitted.
    But not both.
    Regards,
    Rüdiger

  • Getting Error in java mapping: Parsing empty source. Root element expected!

    Hi Experts,
       I am using java mapping for schema validation of input message. I have followed all the standard procedures and implemented the java class in the interface mapping.
    My interface mapping is like this:
    OrderData --->Java Class ---SchemaValidate
                         Mesg Map ---OrderData_to_BAP --->BAPI Msg
    So first I want to validate the schema of the input message. If the input message is invalid then XI should throw an exception. Then I use the actual message mapping to map the input order data to the BAPI input parameters.
    In the java code I am using xerces parser.
    The java code works fine when I run it as a standalone application.
    The interface mapping also works fine if I don't include the java mapping. Ofcourse schema validation does not happen.
    But when I test the interface mapping by including the java mapping then I am getting the error:
    Call method execute of the application Java mapping SchemaValidate
    Java mapping SchemaValidate completed. (execute() of SchemaValidate
    com.sap.aii.utilxi.misc.api.BaseRuntimeException: Parsing an empty source. Root element expected!
    What am I doing wrong? Why it is not getting the root element?
    My Java code is as follows:
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    import com.sap.aii.mapping.api.StreamTransformationException;
    import java.io.*;
    import java.util.Map;
    import javax.xml.parsers.*;
    import org.xml.sax.helpers.*;
    import org.xml.sax.*;
    import org.apache.xerces.jaxp.*;
    Sample mapper for SAP-XI
    @author Gopal
    public class SchemaValidate implements StreamTransformation {
        //Constants when using XML Schema for SAX parsing.
         static final String JAXP_SCHEMA_LANGUAGE =
         "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
         static final String W3C_XML_SCHEMA =
         "http://www.w3.org/2001/XMLSchema";
         static final String JAXP_SCHEMA_SOURCE =
         "http://java.sun.com/xml/jaxp/properties/schemaSource";
    Injection of mapping parameters
    from integration engine
    @param map Map with configuration data
        public void setParameter(Map map) {
    Mapping implementation
    @param inputStream Input data from integration engine
    @param outputStream Output data to integration engine
        public void execute(InputStream inputStream,
                            OutputStream outputStream)
          throws StreamTransformationException {
            try {
                  // obtain an object of class javax.xml.parsers.SAXParser,
                  SAXParserFactory spf = SAXParserFactoryImpl.newInstance();
                  spf.setNamespaceAware(true);
                  spf.setValidating(true);
                  SAXParser sp = spf.newSAXParser();
                  // setup the schema file
                  sp.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
                  sp.setProperty(JAXP_SCHEMA_SOURCE, new File("IOReqMsgSchema.xsd"));
                  //parse the input xml using the given schema
                  sp.parse(inputStream, new ParseErrorHandler());
            catch(SAXException se) {
              se.printStackTrace();
            catch ( Exception e ) {
              throw new StreamTransformationException( e.getMessage() );
    My input message is :
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:OrderCreate_request xmlns:ns0="mynamespace">
       <ORDER>HTEST1234567</ORDER>
       <ORDER_TYPE>z001</ORDER_TYPE>
       <ORDER_NAME>Test Order</ORDER_NAME>
       <CO_AREA>INTC</CO_AREA>
       <CCTR_POSTED>1234567890888888888</CCTR_POSTED>
       <CURRENCY>USD</CURRENCY>
       <PERSON_RESP>12345679</PERSON_RESP>
    </ns0:OrderCreate_request>
    Kindly help! please this is urgent!!!!!!
    Thanks
    Gopal
    Edited by: gopalkrishna baliga on Feb 28, 2008 9:34 AM

    Hi Stefan,
       I did the code changes to return output stream and the java code works perfectly in standalone mode in my PC.
       But when I use the same in the Java mapping with XI then It throws an error "Getting Error in java mapping: Parsing empty source. Root element expected!".
    My XI J2EE server has JDK1.4.3.11.
    Is there any limitation of using SAX parser in XI? If Yes, then which parser should be used for schema validation in XI?
    I have included the XSD file for schema validation along with class files in the .jar file. This jar file is then imported in XI repository. Is the XI engine not able to read the XSD file?
    Do I have to handle reading XSD file differently? Any suggession how?
    Is this parser error due to some security access?
    Kindly help me! I have been struggling with this problem since 2 weeks. I will be greatfull to you if you can help me.
    Thanks
    Gopal

  • Root Element in Syndicator?

    hi All,
    I am currently working with MDM Syndicator.
    My problem is about Root element
    when i am opening in the syndicator file-->destination properties
    it will open dialog box with the following options, (i.e. type,Remote system,port,xml schema,xml file name,Root.
    when i am selecting type as xml schema , romote system(i.e which i have declared in console for that repository). but when i click on OK button.
    it is asking for the Root element required.
    can any one help me about:
    1)what is root element?
    2)where we can declare root element and where we can use it in syndicator?
    3)what actually Root element holds in it?
    can any please provide answers to this questions
    thanks in Advance
    Bharat.chinthapatla

    Hi Michael,
    Thanks for your reply for the pervious question Michael.
    But.................?
    My Problem is..........
    Under Admin in console i  have selected XML Schema table and i have created one record with Name as "xml schema file one" and in the filename field i have clicked on the browse button and selected one .xsd file in the repository.
    (i have tried with .xml schema file also but not....)
    I have opened the syndicator on that particular repository and in the source item i am able to see the table and fields of that particular repository and i have clicked on the file option and i have choosen "Destination properties" it has opened dialog box with different input fields, there i have selected type as "xml schema" and Remote system " MDM "(default). when i selected type as xml schema automatically xml schema input field is enabled and it as shown all the xml schema files or record  which i have created in the XML schema table under Admin of the console.
    But Root element is not enabled, what i have to do?
    In the previous question you have said like this " <b>you have to add an XML Schema to your repository using the <u>corresponding branch</u> in the Console Admin menu</b>.
    what is the corresponding branch in the console Admin menu,  can you please explain me in details...
    if there is any other procedure to come out of this problem, can you please explain me in details ?
    Thanks in advance
    bharat.chinthapatla

  • Multiple Root elements in the XSD Schema

    Hi Dear MDM gurus,
    I have manually created an XSD Schema and I can import it in the Syndicator without any problem.
    I have 3 different Root elements in the schema that I want to use and map to the corresponding table of this type.
    In my Syndicator screen in the Rood dropdown box I can see all three of the Root elements that I have in the schema.
    If I select the first Root element - everything goes fine and I can do my mapping, save the map, etc.
    The problem is that if I select the second or third root element to do the mapping for them, the syndicator does not show the structure in the Item Mapping after that.
    I tried moving the Second root element of the schema and make it first and it works with it, but then the other two are not appearing and I have the same issue.
    Does MDM support only one Root element in the Schema? If that's the case, why does it show all three of them in the dropdown?
    Here is an example:
    1. If I have them in this order in my XSD
              <xs:element name="ManufacturerGroupNumber" type="ManufacturerGroupNumbers"/>
              <xs:element name="SupplierGroupNumber" type="SupplierGroupNumbers"/>
              <xs:element name="SupplierLocationNumber" type="Suppliers"/>
    I can only see the structure when I select the "ManufacturerGroupNumber".
    2. If I have them in the Schema in this order
              <xs:element name="SupplierLocationNumber" type="Suppliers"/>
              <xs:element name="SupplierGroupNumber" type="SupplierGroupNumbers"/>
              <xs:element name="ManufacturerGroupNumber" type="ManufacturerGroupNumbers"/>
    I can only see the structure when I select the first one again "SupplierLocationNumber" and I can only do the mapping for it.
    Any help would be appreciated.
    Thanks in advance,
    Boris

    Hello Satish,
    Thank you for your quick response.
    I read some of the architectural approaches and XML specifications and depending on your design, you may have only one Root element or in rare cases Several Root elements. In my case, I was advised by our PI experts to use Multiple Root elements and this gives me the following:
    Advantages:
    u2022 The reusability of the schema definition is available for all types and all elements defined in the global namespace.
    Disadvantages:
    u2022 Since there are many global elements, there are many valid XML documents.
    I initially had the schema as you suggested, but they didn't like it in PI and advised me to change it with having multiple roots.
    What I'm trying to figure out is if there is a bug in MDM that does not allow to use the rest of the root elements, so I can open an OSS message.
    Thanks,
    Boris

  • ORA-20100: Error occurred while parsing: Start of root element expected.

    I've been searching everywhere for a reason to the following error message: ORA-20100: Error occurred while parsing: Start of root element expected.
    I get this when attempting to parse an XML file stored as a CLOB using the xmlparser.parseClob procedure
    Any help would be much appreciated.

    I initially used US ASCII but then tried several unicode formats as created by XML Spy (UTF16, Unicode16, Unicode32). All had the exact same result.
    Exactly what would be the most helpful output? The XML documents are varied, mostly very simple, but do you want the CLOB printed some other way?
    --Joan Armstrong
    null

  • Exception:"Decrease the number of char between the beginning of the document and its root element"

    I'm now using a javabean in my jsp page to parse xml;when my xml file's size is
    about 10k,it just work fine;when my xml file's size became 50k,it throws the followng
    Exception:
    Failed to open xml document,Failed to retrieve Public id or system id from the
    document. Decrease the number of char between the beginning of the document and
    its root element. But when I run this javabean in JBuild ,it works fine no matter
    how big the xml file becomes;
    Why? the error message is in the attachment.

    The prologue must be included at the top of the document, followed by the root
              element.
              joden2000 wrote:
              > what does this exception mean:decrease the number of char between the beginning
              > of the document and its root element? When my xml file is about 10k,it works
              > just fine,when it becomes 50k ,the exception show.How can I deal with this?
              

  • Java/lang/RuntimeException: Document has no root element

    Hi all,
    Regarding xml parsing in j2me motorola sdk.
    i'm trying to parse an xml file but whenever i run in motorola sdk i get document as no root element error,bt
    if i run with default configuration it runs perfectly fine..,
    would some one come up with the solution for motorola sdk.
    snippet of xml fie:
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <Procedure >................</Procedure >
    Regards,
    sheetal

    it throughs the exception as and when it encounters xml file..,n its nly in motorola sdk ,bt its working fine in other sdk's. http://www.catb.org/~esr/faqs/smart-questions.html#writewell
    How To Ask Questions The Smart Way
    Eric Steven Raymond
    Rick Moen
    Write in clear, grammatical, correctly-spelled language
    We've found by experience that people who are careless and sloppy writers are usually also careless and sloppy at thinking and coding (often enough to bet on, anyway). Answering questions for careless and sloppy thinkers is not rewarding; we'd rather spend our time elsewhere.
    So expressing your question clearly and well is important. If you can't be bothered to do that, we can't be bothered to pay attention. Spend the extra effort to polish your language. It doesn't have to be stiff or formal � in fact, hacker culture values informal, slangy and humorous language used with precision. But it has to be precise; there has to be some indication that you're thinking and paying attention.
    Spell, punctuate, and capitalize correctly. Don't confuse �its� with �it's�, �loose� with �lose�, or �discrete� with �discreet�. Don't TYPE IN ALL CAPS; this is read as shouting and considered rude. (All-smalls is only slightly less annoying, as it's difficult to read. Alan Cox can get away with it, but you can't.)
    More generally, if you write like a semi-literate b o o b you will very likely be ignored. So don't use instant-messaging shortcuts. Spelling "you" as "u" makes you look like a semi-literate b o ob to save two entire keystrokes. Worse: writing like a l33t script kiddie hax0r is the absolute kiss of death and guarantees you will receive nothing but stony silence (or, at best, a heaping helping of scorn and sarcasm) in return.
    If you are asking questions in a forum that does not use your native language, you will get a limited amount of slack for spelling and grammar errors � but no extra slack at all for laziness (and yes, we can usually spot that difference). Also, unless you know what your respondent's languages are, write in English. Busy hackers tend to simply flush questions in languages they don't understand, and English is the working language of the Internet. By writing in English you minimize your chances that your question will be discarded unread.

  • XSD from PI in Syndicator - no root element selectable

    Hello
    I have created a message type in PI and exported the XSD. However when I want to use that XSD in the syndicator no root element is available. Why is that?
    I have searched the forums and found that MDM won't show a root element if the XSD is not sane. What part of the XSD is not sane? I have validated it in Liquid XML and it works in the import manager.
    Has anyone had the same problem?
    BR
    /Alexander

    Hi,
    I also faced same problem. We removed namespace from XSD manually. When u create file from PI it contains namespace.
    It worked then !!!!
    if still not solved tell me in detail i will give eg ..
    Regards
    Himanshu
    reward if helpful

  • ERROR:Start of root element expected

    hi,
    Can any one tell me what this error was. I am getting this error when i try to update a table.
    XML-0108: (Fatal Error) Start of root element expected.
    oracle.xml.sql.OracleXMLSQLException: Start of root element expected.
    at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java, Compiled
    Code)
    at oracle.xml.sql.dml.OracleXMLSave.updateXML(OracleXMLSave.java, Compil
    ed Code)
    at samp3.main(samp3.java, Compiled Code)
    Thanks in advance,
    Joe

    hi,
    Can any one tell me what this error was. I am getting this error when i try to update a table.
    XML-0108: (Fatal Error) Start of root element expected.
    oracle.xml.sql.OracleXMLSQLException: Start of root element expected.
    at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java, Compiled
    Code)
    at oracle.xml.sql.dml.OracleXMLSave.updateXML(OracleXMLSave.java, Compil
    ed Code)
    at samp3.main(samp3.java, Compiled Code)
    Thanks in advance,
    Joe

  • Warnings about root element must be well-formed

    Hey, I just downloaded and am getting running with FlexMetrics.  I'm running this from the ant taskdef.  When I run it, I get what looks to be valid and fine XML reports generated, but I also get a bunch of warnings, each of which reads:
    [flex-metrics] Oct 25, 2010 11:54:00 AM de.bokelberg.flex.parser.AS3Scanner$XMLVerifier verify [flex-metrics] WARNING: The markup in the document preceding the root element must be well-formed. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Error HandlerWrapper.java:195) [flex-metrics] com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrappe r.java:174) [flex-metrics] com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:388)
    The taskdef element is pretty standard:
    <taskdef name="flex-metrics" classname="com.adobe.ac.pmd.metrics.ant.FlexMetricsAntTask" classpath="${flexpmd.libs}/flex-pmd-metrics-ant-task-${flexpmd.version}.jar">
        <classpath>
            <pathelement location="${flexpmd.libs}/flex-pmd-files-${flexpmd.version}.jar" />
            <pathelement location="${flexpmd.libs}/flex-pmd-metrics-${flexpmd.version}.jar" />
            <pathelement location="${flexpmd.libs}/as3-plugin-utils-${flexpmd.version}.jar" />
            <pathelement location="${flexpmd.libs}/as3-parser-${flexpmd.version}.jar" />
            <pathelement location="${flexpmd.libs}/as3-parser-api-${flexpmd.version}.jar" />
            <pathelement location="${flexpmd.libs}/commons-lang-2.4.jar" />
            <pathelement location="${flexpmd.libs}/flex-pmd-ruleset-api-${flexpmd.version}.jar" />
            <pathelement location="${flexpmd.libs}/pmd-4.2.5.jar" />
            <pathelement location="${flexpmd.libs}/dom4j-1.6.1.jar"/>
        </classpath>
    </taskdef>
    References to this look like this:
    <flex-metrics sourcedirectory="${home.project}\src" outputfile="${deploy.dir}/metrics/project.javancss.xml" />
    So I'm not doing anything weird or crazy with it.  I get that error message repeated 42 times.  I can't really seem to correlate that number with anything in my project, i.e. we've got more than 42 mxml files (59 of them), we've got more than 42 AS3 files, etc.  So I'm not really sure what it's hitting 42 times to come up with that error.
    Any ideas on what this might indicate would be greatly appreciated!

    My working theory is that it chokes on instances of the Vector Object (http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Vector.html) but I have yet to verify that conclusively.

  • Declaring namespaces ONLY on root element during serialization

    I'm using JAXP 1.3 and I'd like to be able to serialize a document so that the namespace declarations are only specified once on the root element and not repeated throughout the document.
    I'm working on a journal publication system and the request came from our users (i.e., editors) who say the repeated declarations are distracting when editing the XML. They are using an XML editor (Arbortext), but when they have the view set to display tags all the namespace declarations really clutters up the screen. In particular, we use the MathML namespace:
    <m:math overflow="scroll" xmlns:m="http://www.w3.org/1998/Math/MathML">
    Can this be done?
    Thanks,
    Jeff Bailey

    It's just declared on on the root element on the input file.
    I just tried what you suggested and it worked great. The mathml namespace is only declared on the root element in my output file now.
    Odd that there's a difference between the two methods. For posterity, here's the code I used to serialize the XML:
    TransformerFactory transformerFactory = TransformerFactory
    .newInstance();
    Transformer transformer = transformerFactory.newTransformer();
    transformer.setOutputProperty(OutputKeys.METHOD, "xml");
    transformer.setOutputProperty(OutputKeys.ENCODING, "US-ASCII");
    transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC,
    doc.getDoctype().getPublicId());
    transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM,
    doc.getDoctype().getSystemId());
    OutputStream outputStream = new FileOutputStream(new File(
    "C:\\temp\\foo.xml"));
    transformer.transform(new DOMSource(doc),
    new StreamResult(outputStream));
    Thanks very much for your help.
    Jeff

Maybe you are looking for