XML Document Header

I have created an XML document from scratch using the XmlBeans libraries and sent
it to a file. This Xml file has the root node and all of its containing elements.
But what is missing is the XML document header and my namespace definitions.
Since I don't have the namespace definitions in the document header, the name
spaces are redefined with the xmlns:xxx attrbute for each element in the XML file.
This provides a lot of extra text in the document that is not required.
What do I use in order to create the XML document header? Also how can I add
the namespace definitions to the root element instead of them being defined for
each element in the file? Looking at the documentation, it looked like I might
need to sue the XmlDocumentProperties class but I'm not sure if this is it or
if I need to use other classes too?
Jerald

This worked great. Thanks!
One thing I found through trial and error is that I had to wait until my document
was created, then I created a XmlCursor from my root node. After that I had to
advance my XmlCursor to the first child element (rootCursor.toFirstChildElement())
before actually adding my namespace definitions. Otherwise the namespace definitions
were being added as an additional tag before my root element. But this was documented
in the insertNamespace() member function (inserts into element before cursor).
Thanks again.
Jerald
"Eric Vasilik" <[email protected]> wrote:
>
If you get an InputStream from am XMlBean, it will include the xml decl.
Obtaining
any character based stream will not. Basically, the xml declaration
is generated
when the XmlBean converts to bytes, but not when converted to chars.
You can control the use of namespaces by inserting namespaces on the
root element.
I'm not sure what the current bits are on the website, but there should/will
be a method on the XmlCursor called insertNamespace which you can use
to insert
a prefix/namespace (xmlns:prefix="namespace") as an attribute. The saver
will
use these attributes when persisting the store.
"Jerald Pratt" <[email protected]> wrote:
I have created an XML document from scratch using the XmlBeans libraries
and sent
it to a file. This Xml file has the root node and all of its containing
elements.
But what is missing is the XML document header and my namespace definitions.
Since I don't have the namespace definitions in the document header,
the name
spaces are redefined with the xmlns:xxx attrbute for each element in
the XML file.
This provides a lot of extra text in the document that is not required.
What do I use in order to create the XML document header? Also howcan
I add
the namespace definitions to the root element instead of them beingdefined
for
each element in the file? Looking at the documentation, it looked like
I might
need to sue the XmlDocumentProperties class but I'm not sure if this
is it or
if I need to use other classes too?
Jerald

Similar Messages

  • How to search for a text node with a particular value in an xml document with labview

    supposing i have the following xml document:
    <head>
    <book>
    <bookname>zio</bookname>
    <author>dan</author>
    </book>
    <book>
    <bookname>the spear warrior</bookname>
    <author>britney</author>
    </book>
    <book>
    <bookname>the beard</bookname>
    <author>derrick</author>
    </book>
    </head>
    i want to search for the author of the book "the beard" using for example the V.I Get first match  of labview to access the the node with value "the beard" and then use Get next sibling  V.I  and Get node text content to get get the author of this book..so my question is how do i write the xpath expression for Get first match so as to access the node with bookname "the beard" instantyly?  am trying to minimise the use of loops because they increase the time duration,..thank you (NB:i dont want to use Get all Matched V.I because it obliges me to use a loop in order to access the name derrick and this increases the time duration for my v.i)
    Solved!
    Go to Solution.

    Since it's all text, why not use a real quick Match Pattern (or Regular Expression, but you don't need that much power here), see attached.
    Cameron
    To err is human, but to really foul it up requires a computer.
    The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
    Profanity is the one language all programmers know best.
    An expert is someone who has made all the possible mistakes.
    To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
    LabVIEW Unit 1 - Getting Started
    Learn to Use LabVIEW with MyDAQ
    Attachments:
    Two-stage match demo.vi ‏8 KB

  • Failed to open XML document. Failed to retrieve Public ID

    I have a client posting to Weblogic 6.1 server with the help of Apache
    SOAP 2.2. The posting works fine if the contents of the SOAP message
    is small. But when the contents of SOAP reached more than 11KB, the
    following error occurs:
    Error: 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.
    The SOAP document looks like:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Body>
    <mn:sMethodName xmlns:mn="sMethodURI">
    <batch appid="1">
    <employee>
    <name>...</name>
    <address>...</address>
    </employee>
    <employee>
    <name>...</name>
    <address>...</address>
    </employee>
    </batch>
    </mn:sMethodName>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    The Max Post Size in Weblogic is set to (-1).
    The program is able to handle less than 50 items of
    <employee>.....</employee>. The error occurs when more than 50 items
    are used. The problem is that our application should be able to handle
    more than 1000 items of <employee>....</employee>.
    My questions are:
    1. How should I configure weblogic to solve the problem?
    2. How should I configure the deployment of Apache SOAP to solve the
    problem?
    Pls advise. Thanks.

    One can deduce from the error message that the parser is looking for the
    <?XML...?> portion of the document because that is where the SYSTEM and
    PUBLIC ids are found in the document.
    Peace,
    Cameron Purdy
    Tangosol Inc.
    Tangosol Coherence: Clustered Coherent Cache for J2EE
    Information at http://www.tangosol.com/
    "Grace" <[email protected]> wrote in message
    news:[email protected]...
    >
    Sorry, but I didn't get what you mean. I thought that was handled by theApache
    SOAP API already? And if it couldn't see the XML document header, then whydoes
    this only happens when the document size is large? It doesn't haveproblems whenever
    the document size is small.
    "Cameron Purdy" <[email protected]> wrote:
    It's looking for the XML document header "<?XML" ....
    Peace,
    Cameron Purdy
    Tangosol Inc.
    Tangosol Coherence: Clustered Coherent Cache for J2EE
    Information at http://www.tangosol.com/
    "Grace" <[email protected]> wrote in message
    news:[email protected]...
    I have a client posting to Weblogic 6.1 server with the help of Apache
    SOAP 2.2. The posting works fine if the contents of the SOAP message
    is small. But when the contents of SOAP reached more than 11KB, the
    following error occurs:
    Error: 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.
    The SOAP document looks like:
    <SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Body>
    <mn:sMethodName xmlns:mn="sMethodURI">
    <batch appid="1">
    <employee>
    <name>...</name>
    <address>...</address>
    </employee>
    <employee>
    <name>...</name>
    <address>...</address>
    </employee>
    </batch>
    </mn:sMethodName>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    The Max Post Size in Weblogic is set to (-1).
    The program is able to handle less than 50 items of
    <employee>.....</employee>. The error occurs when more than 50 items
    are used. The problem is that our application should be able to handle
    more than 1000 items of <employee>....</employee>.
    My questions are:
    1. How should I configure weblogic to solve the problem?
    2. How should I configure the deployment of Apache SOAP to solve the
    problem?
    Pls advise. Thanks.

  • XML document does not appear to contain a properly formed DOCTYPE header

    Hi,
    I've created an ejb which uses the studio API to start/execute etc the workflow
    tasks in a generic way. The same ejb contain certain method which I want to use
    as business operations in my workflows. However, when I deploy this ejb as a separate
    application by putting the required jar files in class path it works fine, but
    when I deploy it as a part of WLI application for accessing the business operations
    in workflow I'm getting the following error. I'm entering ejbcomponent entry under
    the wli application tag of config.xml and putting the jar file in the lib directory
    where other jar files are placed. I couldn't understand the reason why it is failing
    when I deploy it as a part of WLI application and not when I deploy it independently.
    Module Name: TestWLPI, Error: The XML parser encountered an error in your deployment
    descriptor. Please ensure that your DOCTYPE is correct. You may wish to compa
    re your deployment descriptors with the WebLogic Server examples to ensure the
    format is correct. The error was:
    weblogic.xml.process.ProcessorFactoryException: XML document does not appear to
    contain a properly formed DOCTYPE header
    at weblogic.xml.process.ProcessorFactory.getProcessor(ProcessorFactory.java:281)
    at weblogic.xml.process.ProcessorFactory.getProcessor(ProcessorFactory.java:224)
    at weblogic.ejb20.dd.xml.DDUtils.processXML(DDUtils.java:267)
    at weblogic.ejb20.dd.xml.DDUtils.processXML(DDUtils.java:242)
    at weblogic.ejb20.dd.xml.DDUtils.processAltDD(DDUtils.java:220)
    at weblogic.ejb20.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:102)
    at weblogic.ejb20.deployer.EJBModule.loadEJBDescriptor(EJBModule.java:500)
    at weblogic.ejb20.deployer.EJBModule.loadDescriptor(EJBModule.java:207)
    at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:714)
    at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:555)
    at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:458)
    at weblogic.management.deploy.slave.SlaveDeployer.prepareAllStagedApplications(SlaveDeployer.java:490)
    at weblogic.management.deploy.slave.SlaveDeployer.initialize(SlaveDeployer.java:253)
    at weblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.initialize(DeploymentManagerServerLifeCycleImpl.java:150)
    at weblogic.t3.srvr.ServerLifeCycleList.initialize(ServerLifeCycleList.java:54)
    at weblogic.t3.srvr.T3Srvr.initialize1(T3Srvr.java:782)
    at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:594)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:282)
    at weblogic.Server.main(Server.java:32)

    javax.xml.stream.XMLStreamException: javax.xml.stream.XMLStreamException: Premature end of file encountered
    at weblogic.xml.stax.XMLStreamReaderBase.prime(XMLStreamReaderBase.java:80)
    at weblogic.xml.stax.XMLStreamReaderBase.setInput(XMLStreamReaderBase.java:99)
    at weblogic.xml.stax.XMLStreamInputFactory.createXMLStreamReader(XMLStreamInputFactory.java:316)
    at weblogic.xml.stax.XMLStreamInputFactory.createXMLStreamReader(XMLStreamInputFactory.java:49)
    at weblogic.application.descriptor.BasicMunger2.<init>(BasicMunger2.java:110)
    at weblogic.application.descriptor.BasicMunger2.<init>(BasicMunger2.java:128)
    at weblogic.application.descriptor.VersionMunger.<init>(VersionMunger.java:74)
    at weblogic.application.descriptor.VersionMunger.<init>(VersionMunger.java:63)
    at weblogic.servlet.internal.WlsWebAppReader2.<init>(WlsWebAppReader2.java:59)
    at weblogic.servlet.internal.WebAppDescriptor$MyWlsWebAppDescriptor.createXMLStreamReader(WebAppDescriptor.java:316)
    at weblogic.application.descriptor.AbstractDescriptorLoader2.createDescriptorBean(AbstractDescriptorLoader2.java:402)
    at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBeanWithoutPlan(AbstractDescriptorLoader2.java:759)
    Any Suggestions plz???
    Thanks

  • Display xml documents - how to submit a feature request?

    Safari is useless when it comes to render raw xml documents. You have to view the actual source to see the xml.
    Is there an official way to submit a feature request for safari to apple? I would love to see something similar to what firefox does with xml. Safari is such a fast and nice browser, if it only could handle text/xml better...

    As you said Safari simply shows all xml element content concatenated together. But no tags or attribute values. If the ContentType in the http header is set to text/xml Firefox shows an xml tree that you can nicely browse. I think IE5+ and Opera do that too. It is important to set the right content type though. Here is an example that shows nice in FF, but is unreadable in Safari:
    http://ww3.bgbm.org/biocase/pywrapper.cgi?dsa=Herbar
    Sure you can look at the source code, but the xml might not be pretty printed.

  • Displaying XML Document in new browser window

    Hi,
    I have a hyperlink on my page. When I click on it, it will open a new IE window and display xml document.
    The new window is displaying some of the xml and at the end displaying the following:
    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    End element was missing the character '>'. Error processing resource 'http://localhost:28080/benchmark/faces/displayXMLDocu...
    However, I cut and paste the xml String where I write it to the HTTPServletResponse to XMLSPY and it displays correctly.
    Please let me know.
    Rgrds

    Here are the steps:
    1. I created page1 that has a hyperlink.
    2. Hyperlink property are set to display page2 in a new window. (popup).
    3. page2.prerender() method, I set the response to the following:
    public void prerender() {
    javax.faces.context.ExternalContext ec = this.getExternalContext();
    HttpServletResponse response = (HttpServletResponse)ec.getResponse();
    response.setHeader("Cache-Control","no-cache");
    response.setHeader("Cache-Control","no-store");
    response.setHeader("Cache-Control","must-revalidate");
    response.setHeader("Cache-Control","max-age=0");
    response.setHeader("Pragma","no-cache");
    response.setHeader("Expires","0");
    response.setContentType("text/xml");
    response.setBufferSize(5000);
    String xmlString = getRequestBean1().getBookingPnrDetailsXML();
    try{
    xmlString="<?xml version=\"1.0\" encoding=\"UTF-8\"?><root><test1>this is a test</test1><victor>Hello Victor</victor></root>";
    PrintWriter out = new PrintWriter(response.getOutputStream());
    log(xmlString);
    out.print(xmlString);
    }catch(IOException io){
    System.out.println("" + io.getMessage());
    io.printStackTrace();
    4.page2.jsp code is the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://www.sun.com/web/ui">
    <jsp:directive.page contentType="text/xml;charset=UTF-8" pageEncoding="UTF-8"/>
    <f:view/>
    <ui:page binding="#{displayXMLDocument.page1}" id="page1"/>
    <ui:html binding="#{displayXMLDocument.html1}" id="html1"/>
    <ui:head binding="#{displayXMLDocument.head1}" id="head1"/>
    <ui:link binding="#{displayXMLDocument.link1}" id="link1"/>
    <ui:body binding="#{displayXMLDocument.body1}" id="body1"/>
    <ui:form binding="#{displayXMLDocument.form1}" id="form1"/>
    </jsp:root>
    please let me know.
    Rgrds.

  • Heap space error while creating XML document from Resultset

    I am getting Heap space error while creating XML document from Resultset.
    It was working fine from small result set object but when the size of resultset was more than 25,000, heap space error
    I am already using -Xms32m -Xmx1024m
    Is there a way to directly write to xml file from resultset instead of creating the whole document first and then writing it to file? Code examples please?
    here is my code:
    stmt = conn.prepareStatement(sql);
    result = stmt.executeQuery();
    result.setFetchSize(999);
    Document doc = JDBCUtil.toDocument(result, Application.BANK_ID, interfaceType, Application.VERSION);
    JDBCUtil.write(doc, fileName);
    public static Document toDocument(ResultSet rs, String bankId, String interfaceFileType, String version)
        throws ParserConfigurationException, SQLException {
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = factory.newDocumentBuilder();
            Document doc = builder.newDocument();
            Element results = doc.createElement("sims");
            results.setAttribute("bank", bankId);
            results.setAttribute("record_type", "HEADER");
            results.setAttribute("file_type", interfaceFileType);
            results.setAttribute("version", version);
            doc.appendChild(results);
            ResultSetMetaData rsmd = rs.getMetaData();
            int colCount = rsmd.getColumnCount();
            String columnName="";
            Object value;
            while (rs.next()) {
                Element row = doc.createElement("rec");
                results.appendChild(row);
                for (int i = 1; i <= colCount; i++) {
                    columnName = rsmd.getColumnLabel(i);
                    value = rs.getObject(i);
                    Element node = doc.createElement(columnName);
                    if(value != null)
                        node.appendChild(doc.createTextNode(value.toString()));
                    else
                        node.appendChild(doc.createTextNode(""));
                    row.appendChild(node);
            return doc;
    public static void write(Document document, String filename) {
            //long start = System.currentTimeMillis();
            // lets write to a file
            OutputFormat format = new OutputFormat(document); // Serialize DOM
            format.setIndent(2);
            format.setLineSeparator(System.getProperty("line.separator"));
            format.setLineWidth(80);
            try {
                FileWriter writer = new FileWriter(filename);
                BufferedWriter buf = new BufferedWriter(writer);
                XMLSerializer FileSerial = new XMLSerializer(writer, format);
                FileSerial.asDOMSerializer(); // As a DOM Serializer
                FileSerial.serialize(document);
                writer.close();
            } catch (IOException ioe) {
                ioe.printStackTrace();
            //long end = System.currentTimeMillis();
            //System.err.println("W3C File write time :" + (end - start) + "  " + filename);
        }

    you can increase your heap size..... try setting this as your environment variable.....
    variable: JAVA_OPTS
    value: -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m

  • Could not retrieve attributes from XML document loaded in JDOM

    Hi All,
    I am having difficulty reading and parsing the following XML City.xml document using Saxon parser and XPath:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional/ /EN" "http://www. w3.org/TR/ xhtml1/DTD/ xhtml1-transitio nal.dtd">
    <html xmlns="http: //www.w3. org/1999/ xhtml">
        <head>
            <meta http-equiv=" Content-Type" content="text/ html; charset=UTF- 8" />
        </head>
        <body>
            <div id="content">
                <table class="sresults">
                    <tr>
                        <td>
                            <a href="http:/ /www.abc.com/areas" title=" Hollywood , CA "> hollywood </a>
                        </td>
                        <td>
                            <a href="http:/ /www.abc.com/areas" title=" San Jose , CA "> san jose </a>
                        </td>
                        <td>
                            <a href="http:/ /www.abc.com/areas" title=" San Francisco , CA "> san francisco </a>
                        </td>
                        <td>
                            <a href="http:/ /www.abc.com/areas" title=" San Diego , CA "> San diego </a>
                        </td>
                    </tr>
            </body>
    </html> Below is the code snippets that illustrates how I tried to retrieve the attribute title of <a>:
    1. BufferedReader incomingbrXml = new BufferedReader(new FileReader("C:\City.xml"));
    2. SAXBuilder saxBuilder = new SAXBuilder(false);
    3. Document jdomXmlDocument = saxBuilder.build(incomingbrXml);4. String city_content = null;
    5. XPath cityXPath = XPath.newInstance("/ns:html/ns:body/ns:div[@id='content']/ns:table[@class='sresults']/ns:tr/ns:td/ns:a/@title");
    6. java.util.List cityList = cityXPath.selectNodes(jdomXmlDocument);
    7. Iterator city_iterator = cityList.iterator();
    8. while (city_iterator.hasNext()) {
    9.     city_content = ((org.jdom.Attribute)city_iterator.next()).getValue();
    10.   if (city_content.length() != 0) {
    11.       System.out.println("Area Url:" + area_content.toString()); }
    12. } I would like to get the following output:
    Hollywood , CA
    San Jose , CA
    San Francisco , CA
    San Diego , CA
    Instead, the jdomXmlDocument is made up of only the first few lines of City.xml and nothing on the body when debugging in Netbeans and nothing in cityList. I am running this program online so there would not be an issue with entity resolver that took place on line 2.
    I am running JDK 1.6.0_17, Netbeans 6.7, JDOM 1.1, Saxon9.1 on Windows XP platform.
    Any assistance would be appreciated.
    Thanks in advance,
    Jack.

    Hi,
    Correction to line 11 - System.out.println("City title:" + city_content.toString()); instead.
    Thanks,
    Jack

  • XML document must have a top level element. Error processing resource

    Hi,
    I am trying to send a XML file to a web browser from a servlet. I read the contents of the XML file into a string and I am sending it to the brower. Before I do this I set the 'Content-type' header of the httpResponse to "application/xml" . Embedded in the XML file is an xml-stylesheet elemetn indicating which *.xsl stylesheet to use to parse the XML content.
    I get the following error:
    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    XML document must have a top level element. Error processing resource 'http://127.0.0.1:8080/testReplyingXML/xml-to-html.xs...
    Now, if I take the stylesheet element out of the XML string I sent, then the browser stores the content into and *.xml file. I manually run the "xml-to-xsl " stylesheet mentioned in the error output above, and there is no problem, the xml content gets successfully transformed in a viewable HTML .
    It is only when I embed the "stylesheet" element into the XML content that I get this error.
    So the browser is receiveing valid XML.
    I am not sure if the above error is complaining about the XML content I send or the stylesshet .
    Does anyone have an idea of what am I doing wrong?
    For your information here are my servlet code and the XML file:
    servlet:-
    package webapps.testReplyingXML;
    import java.io.BufferedReader;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.FileReader;
    import java.util.Enumeration;
    import java.util.StringTokenizer;
    import java.io.PrintWriter;
    public class ReplyXML extends HttpServlet {
              static int transactionCount = 0;
              public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException ,IOException {
                   String Q_PARAM = "query";
                   String requestString = req.getQueryString();
                   for ( Enumeration en = req.getParameterNames() ; en.hasMoreElements() ; )
         String k = (String)en.nextElement() ;
         String[] x = req.getParameterValues(k) ;
         String s = null;
         String DATA_PARAM= "";
         for(int i = 0 ; i < x.length ; i++ )
         s = x[i] ;
         //System.out.println("s = " + s);
         if (k.equals("query")){
              try {
                             //res.setHeader("Content-Type", "application/xml");
                             //res.setHeader("Transfer-Encoding", "chunked");
                             //res.setHeader("Cache-Control", "no-cache");
                             //res.setHeader("Server", "Jetty/5.1.10");
                             //res.setHeader("Pragma", "no-cache");
                             //res.setHeader("X-Joseki-Server", "Joseki-3.0-dev");
                             res.setStatus(res.SC_OK);
                             StringBuffer fileData = new StringBuffer(1000);
                        BufferedReader reader = new BufferedReader(new FileReader("sparql_results.xml"));
                        char[] buf = new char[1024];
                        int numRead=0;
                        while((numRead=reader.read(buf)) != -1){
                        String readData = String.valueOf(buf, 0, numRead);
                        fileData.append(readData);
                        buf = new char[1024];
                        reader.close();
                        String xmlMsg= fileData.toString();
                        System.out.println("XMLMSG= " + xmlMsg);
                             PrintWriter outresp = res.getWriter();
                             outresp.println(xmlMsg);
                             outresp.close();
              }catch (Exception e) {
                   e.printStackTrace();
              public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
                   doGet(req, res);
    XML FILE:
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="xml-to-html.xsl"?>
    <sparql
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:xs="http://www.w3.org/2001/XMLSchema#"
    xmlns="http://www.w3.org/2005/sparql-results#" >
    <head>
    <variable name="book"/>
    <variable name="title"/>
    </head>
    <results ordered="false" distinct="false">
    <result>
    <binding name="book">
    <uri>http://example.org/book/book6</uri>
    </binding>
    <binding name="title">
    <literal>Harry Potter and the Half-Blood Prince</literal>
    </binding>
    </result>
    <result>
    <binding name="book">
    <uri>http://example.org/book/book5</uri>
    </binding>
    <binding name="title">
    <literal>Harry Potter and the Order of the Phoenix</literal>
    </binding>
    </result>
    <result>
    <binding name="book">
    <uri>http://example.org/book/book4</uri>
    </binding>
    <binding name="title">
    <literal>Harry Potter and the Goblet of Fire</literal>
    </binding>
    </result>
    <result>
    <binding name="book">
    <uri>http://example.org/book/book3</uri>
    </binding>
    <binding name="title">
    <literal>Harry Potter and the Prisoner Of Azkaban</literal>
    </binding>
    </result>
    <result>
    <binding name="book">
    <uri>http://example.org/book/book2</uri>
    </binding>
    <binding name="title">
    <literal>Harry Potter and the Chamber of Secrets</literal>
    </binding>
    </result>
    <result>
    <binding name="book">
    <uri>http://example.org/book/book1</uri>
    </binding>
    <binding name="title">
    <literal>Harry Potter and the Philosopher's Stone</literal>
    </binding>
    </result>
    </results>
    </sparql>

    Error processing resource http://127.0.0.1:8080/testReplyingXML/xml-to-html.xs...
    Well, if one more character had been deleted from that message then you would have a problem. But as it is, the error message says there's an error processing a resouce whose name ends with "xml-to-html.xs" followed by something. That would be the stylesheet if I'm not mistaken. Most likely the browser can't find it at the URL mentioned in the error message.

  • Returning XML Document

    I am having trouble (weblogic 7.0) exposing an EJB web service. It
    takes string parameters in and should return an XML document. I've
    ported this from apache axis, the java method takes java.lang.String
    parameters and returns org.w3c.dom.Element ... this works fine on
    Jboss 3.2.0. Can anyone help me figure out how to do the same on
    weblogic? My web-services.xml file is as follows now:
    <web-services>
         <web-service name="myService"
    targetNamespace="http://www.bobo.com"
    uri="/jboss-net/services/myService">
              <components>
                   <stateless-ejb name="myService">
                        <ejb-link
    path="myjarfile.jar#MyServiceService"/>
                   </stateless-ejb>
              </components>
              <operations>
                   <operation name="runQuery"
    invocation-style="request-response" component="myService" >
                        <params>
                             <param name="in0" style="in"
    type="xsd:string" location="header"/>
                             <param name="in1" style="in"
    type="xsd:string" location="header"/>
                             <param name="in2" style="in"
    type="xsd:string" location="header"/>
                             <param name="in3" style="in"
    type="xsd:string" location="header"/>
                             <return-param name="result"
    type="xsd:anyType"/>
                        </params>               
                   </operation>
              </operations>     
    </web-service>
    </web-services>
    Feel free to respond to the group or to [email protected]
    John

    Hello,
    Are you using servicegen against the EJB?
    http://edocs.bea.com/wls/docs81/webserv/anttasks.html#1063540
    Using a stateless session EJB example can be found here:
    http://webservice.bea.com/statelessSession.zip and there is a dom
    example here: http://webservice.bea.com/dom.zip
    Thanks,
    Bruce
    Hauss wrote:
    >
    I am having trouble (weblogic 7.0) exposing an EJB web service. It
    takes string parameters in and should return an XML document. I've
    ported this from apache axis, the java method takes java.lang.String
    parameters and returns org.w3c.dom.Element ... this works fine on
    Jboss 3.2.0. Can anyone help me figure out how to do the same on
    weblogic? My web-services.xml file is as follows now:
    <web-services>
    <web-service name="myService"
    targetNamespace="http://www.bobo.com"
    uri="/jboss-net/services/myService">
    <components>
    <stateless-ejb name="myService">
    <ejb-link
    path="myjarfile.jar#MyServiceService"/>
    </stateless-ejb>
    </components>
    <operations>
    <operation name="runQuery"
    invocation-style="request-response" component="myService" >
    <params>
    <param name="in0" style="in"
    type="xsd:string" location="header"/>
    <param name="in1" style="in"
    type="xsd:string" location="header"/>
    <param name="in2" style="in"
    type="xsd:string" location="header"/>
    <param name="in3" style="in"
    type="xsd:string" location="header"/>
    <return-param name="result"
    type="xsd:anyType"/>
    </params>
    </operation>
    </operations>
    </web-service>
    </web-services>
    Feel free to respond to the group or to [email protected]
    John

  • How to extract the actual XML document from soap message?

    My problem is " how to extract the actual XML document from soap message? "
    i just want to extract the attachment i.e. (pure XML document without any soap header or envolope).
    i could be ver thank full if u could solve my problem.
    [email protected]

    Hi,
    This is some skeleton code for extracting an attachment from a SOAPMessage.
    import javax.activation.DataHandler.;
    import javax.xml.soap.*;
    import javax.xml.message.*;
    Iterator allAttachments = message.getAttachments();
    AttachmentPart ap1 = null;
    while(allAttachments.hasNext()){
    ap1 = (AttachmentPart)allAttachments.next();
    //Check that the attachment is correct one. By looking at its mime headers
    //Convert the attachment part into its DOM representation:
    if(ap1.getContentType() == "text/xml"){
    //Use the activation dataHandler class to extract the content, then create a StreamSource from
    //the content.
    DataHandler attachmentContent = ap1.getDataHandler();
    StreamSource attachmentStream = new StreamSource(attachmentContent.getInputStream());
    DOMResult domAttachment = getDOMResult(attachmentStream);
    domAttachment holds an xml representation of the attachment.
    Hope this helps.

  • Trouble IMPORTING xml DOCUMENT....

    I may be banging my head against the wall (as usual)....
    but is there any way to import an xml document (a sequence from a fcp project) created in fcp 5.1.2 into my fcp version 5.0.4 --?
    I'm asked to 'choose a translation document file', when I go into my apps and select fcp, I get 'no translation templates matching the selected xml file were found. Unable to import'
    Thanks.

    I just got thru working a project with someone in 5.0.4 and I'm in 5.1 -- we did xml transfers back and forth and it worked very well.
    For some reason I chose to use XML version 2 out of the export window (just a guess) and it worked great.
    One thing I had to do was keep opening a new project file with the xml (but this mainly was to keep the other person from getting too confused.)
    It SHOULD work for you... it did me.
    File - Export - XML... or right click the sequence and Export as XML... then choose version 2 (or try the others too).
    Good luck,
    CaptM

  • IsSchemaValid does chang the xml-encoding header from UTF-8 to WINDOWS-1252

    I found the following effect:
    isSchemaValid does changing the encoding - entry of the xml-file-header
    generating xml-file by using DBMS_XMLGEN :
    xmldoc := DBMS_XMLGEN.getXML(ctx);
    with the header of the file is
    <?xml version="1.0" encoding="UTF-8"?>
    change the xmldoc to a xmlType
    and validate it against the schema
    xmldoc_xmlType:=(xmltype(xmldoc)) ;
    xmldoc_xmlType.isSchemaValid ( bSchemalocation)
    after this the header of the file is
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    my DB:
    R11_2_0_2 / Windows 64
    the same in
    R11_2_0_1 / Windows 32
    select name, value from v$parameter where upper(name) like '%NLS%'
    nls_calendar     
    nls_comp          BINARY
    nls_currency     
    nls_date_format     
    nls_date_language     
    nls_dual_currency     
    nls_iso_currency     
    nls_language          AMERICAN
    nls_length_semantics     BYTE
    nls_nchar_conv_excp     FALSE
    nls_numeric_characters     
    nls_sort     
    nls_territory          AMERICA
    nls_time_format     
    nls_timestamp_format     
    nls_timestamp_tz_format     
    nls_time_tz_format     
    register my schema by:
    dbms_xmlschema.registerSchema(
    schemaurl => vschemaurl,
    schemadoc => xsd_file,
    local      => FALSE,      
    gentypes      => TRUE,      
    genbean      => FALSE,      
    gentables      => TRUE,      
    force      => FALSE,
    owner      => dbuser
    ,CSID      => nls_charset_id('AL32UTF8')
    How can I let or change back the xml-encoding entry to UTF-8 ?
    regards

    Your solution should not be relied upon...
    C:\Temp>sqlplus /nolog @t1 %CD%
    SQL*Plus: Release 11.2.0.2.0 Production on Fri Mar 4 09:41:32 2011
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    SQL> spool testcase.log
    SQL> --
    SQL> connect sys/oracle as sysdba
    Connected.
    SQL> --
    SQL> set define on
    SQL> set timing on
    SQL> --
    SQL> def XMLDIR = &1
    SQL> --
    SQL> def USERNAME = XDBTEST
    SQL> --
    SQL> def PASSWORD = &USERNAME
    SQL> --
    SQL> def USER_TABLESPACE = USERS
    SQL> --
    SQL> def TEMP_TABLESPACE = TEMP
    SQL> --
    SQL> drop user &USERNAME cascade
      2  /
    old   1: drop user &USERNAME cascade
    new   1: drop user XDBTEST cascade
    User dropped.
    Elapsed: 00:00:00.24
    SQL> grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
      2  /
    old   1: grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
    new   1: grant create any directory, drop any directory, connect, resource, alter session, create view to XDBTEST identified by XDBTEST
    Grant succeeded.
    Elapsed: 00:00:00.07
    SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
      2  /
    old   1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
    new   1: alter user XDBTEST default tablespace USERS temporary tablespace TEMP
    User altered.
    Elapsed: 00:00:00.00
    SQL> set long 100000 pages 0 lines 256 trimspool on timing on
    SQL> --
    SQL> connect &USERNAME/&PASSWORD
    Connected.
    SQL> --
    SQL> create or replace directory XMLDIR as '&XMLDIR'
      2  /
    old   1: create or replace directory XMLDIR as '&XMLDIR'
    new   1: create or replace directory XMLDIR as 'C:\Temp'
    Directory created.
    Elapsed: 00:00:00.00
    SQL> create table XML_DEFAULT of XMLTYPE
      2  /
    Table created.
    Elapsed: 00:00:00.11
    SQL> create table XML_CLOB of XMLTYPE
      2  XMLTYPE store as CLOB
      3  /
    Table created.
    Elapsed: 00:00:00.01
    SQL> select *
      2    from nls_database_parameters
      3   where parameter in ('NLS_LANGUAGE', 'NLS_TERRITORY', 'NLS_CHARACTERSET')
      4  /
    NLS_LANGUAGE                   AMERICAN
    NLS_TERRITORY                  AMERICA
    NLS_CHARACTERSET               AL32UTF8
    Elapsed: 00:00:00.02
    SQL> declare
      2    XML_DEFAULT XMLType := xmltype('<?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>') ;
      3    XML_CLOB    XMLType := xmltype('<?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>') ;
      4  begin
      5    delete XML_DEFAULT;
      6    delete XML_CLOB;
      7    insert into XML_DEFAULT values (XML_DEFAULT);
      8    dbms_xslprocessor.clob2file( XML_DEFAULT.getclobval() , 'XMLDIR','XML_DEFAULT.xml');
      9    IF  XML_DEFAULT.isSchemaValid ( 'SCHEMALOCATION_DOES_NO_MATTER_FOR_TEST_CASE.XSD', 'SCHEMA_NO_MATTER') = 1 THEN  null; ELSE  null; END IF;
    10    commit;
    11    dbms_xslprocessor.clob2file( XML_DEFAULT.getclobval() , 'XMLDIR','XML_DEFAULT_IS_VALID.xml',nls_charset_id('WE8MSWIN1252'));
    12    dbms_xslprocessor.clob2file( XML_DEFAULT.getclobval() , 'XMLDIR','XML_DEFAULT_WIN1252.xml');
    13    insert into XML_CLOB values (XML_CLOB);
    14    dbms_xslprocessor.clob2file( XML_CLOB.getclobval() , 'XMLDIR','XML_CLOB.xml');
    15    commit;
    16  end ;
    17  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.27
    SQL> --
    SQL> host type XML_DEFAULT.xml
    <?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>
    SQL> --
    SQL> host type XML_DEFAULT_IS_VALID.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <TEST>SELECT</TEST>
    SQL> --
    SQL> host type XML_DEFAULT_WIN1252.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <TEST>SELECT</TEST>
    SQL> --
    SQL> host type XML_CLOB.xml
    <?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>
    SQL> --
    SQL>First, the character set changes because isSchemaValid() causes the document to be parsed and converted to the internal database character set, as does storing it in a table.
    It appear that your solution works in SQL because the semantics of SQL are such that it causes a 'copy' of the XMLType to take place before running the isSchemaValid() processing, were we to optimize away that copy as a result of a patch or performance optimization project then you solution would break...
    If you want the output in a particular character set you should force that using XMLSerialize or getBlobVal(charsetid). Unfortunately we don't have a convience method for writing BLOBS on DBMS_XSLPROCESSOR...

  • Large XML Document Error

    We are using Oracle's XSQL servlet engine 9.0.2.0.0A to query an Oracle Database using xsql:include-owa. This xsql document uses a custom serializer to write the resulting XML to a file on the webserver. We have run into a problem with writing XML documents larger than approximatly 7MB. The file is written but just contains a Malformed XML Document error. We have tried tracking down the problem and it seems to be occuring before the custom serializer is given control of the document. Attached below is the xsql document and the Java source of our serializer if it would be of any help.
    -Eric Dalquist
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="simple_transform_xml.xsl" serializer="XMLWriter"?>
    <BASE_TAG connection="XXXXXXXX" xmlns:xsql="urn:oracle-xsql">
        <xsql:set-page-param name="save-file" value="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/applInfo.xml"/>
        <xsql:include-owa >
            STUDEV.STUADMSDSET.P_GET_RECRUIT_INFO('A','C');
        </xsql:include-owa>
    </BASE_TAG>-----------------------------------------
    * Author:        Eric Dalquist
    * E-Mail:        [email protected]
    * Date Created:  10-03-2001
    * Last Modified: 10-03-2001
    * Modified By:   Eric Dalquist
    * Description:   This class writes out the contents of the final document produced by the xsql servlet.
    package com.mtu.XSQLSerializers;
    import java.io.FileOutputStream;
    import oracle.xml.xsql.*;
    import oracle.xml.parser.v2.XMLDocument;
    import org.w3c.dom.Document;
    * <P>
    *    XMLWriter is an implementation of the abstract XSQLDocumentSerializer class. It is passed a refrence to a DOM Document
    *    and the servlet environment. The XMLWriter takes the document and writes it out to the servlet's output stream. There
    *    is also the option that the saveFile xsql page parameter can be set to a fully qualified path and file name to write the
    *    document to.
    * </P>
    * <P>
    *    Here is an example of setting the saveFile page paramter. This line would be the first tag inside the root xsql servlet tag.
    * </P>
    * <PRE>
    *    &#060;xsql:set-page-param name="save-file" value="/u01/oracle/ias10210/xdk/java/xsql/Repository/Course_List/XMLDocument.xml"/&#062;
    * </PRE>
    * @author  Eric B. Dalquist
    * @version 1.0 10/03/2001
    public class XMLWriter implements XSQLDocumentSerializer
        /** the header we send if we are returning XML */
        private static final String MIME_XML = "text/xml";
        /** the name of the page parameter we look for to get the path and name to save the XML document to */
        private static final String ATTR_FILE = "save-file";
         * The serialize is called by the servlet engine and is passed the DOM Docuement result
         * from the XSLT transformation if there was one and a refrence to the XSQL servlet environment
         * @param doc The document representation of the XML output of the xsql servlet.
         * @param env A refrence to the servlet's environment.
         * @throws Throwable Any unhandled error is handled by the servlet by default.
        public void serialize(Document doc, XSQLPageRequest env) throws Throwable
            System.out.print("start ... ");
            FileOutputStream fos = null;
            String reqType = env.getRequestType();
            String saveFile = env.getParameter(ATTR_FILE);
            if (!reqType.equals("Command Line"))
                env.setContentType(MIME_XML);
                ((XMLDocument)doc).print(env.getOutputStream());
                env.getOutputStream().close();
            if (saveFile != null && !saveFile.equals("") && saveFile.indexOf("..") == -1 && saveFile.indexOf("~") == -1)
                fos = new FileOutputStream(saveFile);
                ((XMLDocument)doc).print(fos);
                fos.close();
            System.gc();
            System.out.println("end");
    }

    Technically DBMS_XMLSAVE and it's alter ego DBMS_XMLQUERY are not considered part of XML DB. DBMS_XMLSAVE and DBMS_XMLQUERY are legacy Java implementations.
    In 9.2.x these routines were replaced by DBMS_XMLSTORE and DBMS_XMLGEN which are written in 'C' and should be much faster in most cases and address a number of limitations inherant in the older implementations. DBMS_XMLSTORE and DBMS_XMLGEN are part of XML DB and the minimum supported release for XML DB is 9.2.0.3.0.
    DBMS_XMLSAVE issues are addressed in the TECH/XML forum
    http://forums.oracle.com/forums/category.jspa?categoryID=51

  • XML Document initialization.

    Hi,
    I need to parse an XML document that I read Externally.
    Presently for testing I need to simulate this by hardcoding the xml from Web Dynpro :
    eg: Document xmlSimulate =
    <?xml version="1.0" encoding="iso-8859-1" ?>
    - <DecisionTree>
    +<Header>
    +<Body>
    </DecisionTree>
    Please let me know how I can do this ???
    Awaiting your kind responses.
    Regards,
    Mahesh

    Hi,
    to parse a xml document in java you can either use SAX or DOM. If you want to generate java objects by xml JAXB is a good choice. You can find very much tutorials on the web (try google).
    Regards
    Sebastian

Maybe you are looking for

  • Using server time in  Timer Class

    Hai, I have develped an application(stand alone) using swings. the exe runs in all the systems in my company. requirement is --> application has to be closed at 11.59 P.M everyday. i did this task using Timer class. Timer class takes the system time

  • About standard text

    1.How do u transport STANDARD TEXT from development client to quality client or to development?

  • SLiM crashes X on switch to console, prevents resume

    i'm facing something of a mystery, here. when i switch to a virtual console ( <ctrl>+<alt>+f{1-9} ) after logging into a desktop session via slim, the x session crashes and i'm presented with a new slim login screen. i first noticed this while (final

  • Redirecting Fault Response to JMS queue

    Hi Everyone, We have a proxy which will pole the request from RequestQueue and call a proxy service(backend) and wait for the response from the proxy service(backend). Once we get the response, it has to put the response to the ResponseQueue. Request

  • Export metadata in Bridge

    Is there a way to export the metadata for each image in Bridge?Currently the export option only includes the file name and extension.