Unable to test creation of XML document
I tried the JUnit forum first and they suggested a XML forum
I suspect that this could be a simple mistake in my code or a race condition. Please see the comments in the code.
My test is this. I create a org.w3c.dom.Document using my class EncryptedData
@Test
public void testDocument() throws TransformerException {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
documentBuilder = dbf.newDocumentBuilder();
Document document = documentBuilder.newDocument();
EncryptedData encryptedData = new EncryptedData( document );
assertNotNull( encryptedData.getEncryptedData() );
printXML( encryptedData.getEncryptedData() );
} catch (ParserConfigurationException e) {
This is EncryptedData.java.
private Element encryptedData;
private Document document;
public EncryptedData( Document document ) {
this.document = document;
encryptedData =
(Element)
document.createElement("EncryptedData");
+//When I append the child in the constructor there is no exception+
document.appendChild( encryptedData );
public Document getEncryptedData(){
+//When I append the child in this method there is an exception+
encryptedData =
(Element)
document.createElement("EncryptedData");
return document;
org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a
node where it is not permitted.
at org.apache.xerces.dom.CoreDocumentImpl.insertBefore(Unknown Source)
at org.apache.xerces.dom.NodeImpl.appendChild(Unknown Source)
at
com.fss.maps.security.xml.EncryptedData.getEncryptedData(EncryptedData.java:56)
at
com.fss.maps.security.test.XMLEncryptionTestCase.testDocument(XMLEncryptionTestC\
ase.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav\
a:25)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java\
:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:\
15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:4\
1)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20\
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76\
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50\
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunne\
r.java:97)
at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter\
.java:192)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
that is what you expect, but still you have the proof that something else is going on. It is not going to make any difference where you call code, both will work the same. But "it is not working", so you are doing something wrong without realizing it.
Step through the code in a debugger and see what is really happening.
Similar Messages
-
Unable to block creation of sales document from Quotation thru user status
Dear Experts,
I have maintained a status profile in my Quotation document through the use of user status. I have defined a status to forbid creation of sales document if the status has not yet been set to "Approved".
However, even when the status is not yet "Approved", it still allows me to create subsequent sales document from this Quotation.
Anything that I have missed here?Hi,
It should not happen.
Please check the Object types for which the status profile is created. It should be for either Sales Order header or Sales order Item.
Make sure that the "create sales document" is "forbiddden" for the initial status only.
Also please check Low- High numbers for each status.
Hope this helps.
Regards,
Sharan -
Hi folks,
I am using a cascaded mapping in my OM. I have a graphical mapping followed by the Java mapping. It is a flat file to IDOC mapping. Everything works fine in Dev but when I transport the same objects to QA, the Operation mapping though it doesn't fail in ESR testing tool, gives the following message and there is no output generated for the same payload which is successfully tested in DEV. Please advise on what could be the possible reasons.
Unable to display tree view; Error when parsing an XML document (Premature end of file.)kalyan,
There seems to be an invalid xml payload which causes this error in ESR not generating the tree view. Please find the similar error screenshot and rectify the payload.
Mutti -
Hi All,
We have a scenario of FTP-->PI---> Webservice. While triggering the data in the FTP, it is failing in the PI with the below error
SOAP: response message contains an error XIAdapter/PARSING/ADAPTER.SOAP_EXCEPTION - soap fault: Server was unable to read request. ---> There is an error in XML document (1, 447). ---> Input string was not in a correct format.
Can you please help?Hi Raja- It seems to be a data quality issue.
Check for the value @ 1447 position in the xml message that you are trying to send to web service..
may be a date filed/decimal value which is not in expected format. -
Creation of a XML Document with DTD entry
I am trying to create a XML file on the fly. I use the
NodeFactory to contruct a document (createDocument()). I have
then setStandalone("no") and setVersion("1.0"). when I try to
add a DOCTYPE node via appendChild( new XMLNode("test",
Node.DOCUMENT_TYPE_NODE)), I get a ClassCastException.
This is using the 1.0.1.1.0 xml parser.
What is the mechanism to add a node of this type? I noticed that
the NodeFactory did not have a machanism for creating a DOCTYPE
node.
nullNestor Dutko (guest) wrote:
: I am trying to create a XML file on the fly. I use the
: NodeFactory to contruct a document (createDocument()). I have
: then setStandalone("no") and setVersion("1.0"). when I try to
: add a DOCTYPE node via appendChild( new XMLNode("test",
: Node.DOCUMENT_TYPE_NODE)), I get a ClassCastException.
: This is using the 1.0.1.1.0 xml parser.
: What is the mechanism to add a node of this type? I noticed
that
: the NodeFactory did not have a machanism for creating a DOCTYPE
: node.
There is no mechanism to create a new DOCUMENT_TYPE_NODE object
via DOM APIs. The only way to get a DTD object is to parse the
DTD file or the XML file using the DOMParser, and then use the
getDocType() method. Note that new XMLNode("test",
Node.DOCUMENT_TYPE_NODE) does not create a DTD
object. It creates an XMLNode object with the type set to
DOCUMENT_TYPE_NODE, which infact should not be allowed. The
ClassCastException is raised because appendChild expects a DTD
object (based on the type).
Also, we do not do any validation while creating the DOM tree
using the DOM APIs. So setting the DTD in the Document will not
help in validating the DOM tree that is constructed. The only way
to validate an XML file is to parse the XML document using
DOMParser or SAXParser.
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
null -
XML document creation using reflection
Hi all,
I'm tyring to write a class which creates an XML document from objects passed in. For example, you call the add(Object) method and it takes your object, uses reflection, then outputs XML like this...
<fieldName>fieldValue<fieldName>
The only problem is that after looking through this forum I am a little concerned about the performance of my proposed solution (using reflection).
The class will be used in a batch process which processes millions of objects (to generate a whopping XML file that'll be sent on for further processing by a third party).
Is there a better way to do this than by using reflection?
This class is going to be used by multiple batch processes hence there will be lots of different object types passed (they'll also be new ones in the future that we don't even know about yet) hence my reflection choice.
Thanks,
ChrisThe only problem is that after looking through this
forum I am a little concerned about the performance of
my proposed solution (using reflection).The only way that you'll know for sure is if you try it out. Write the code, test it, then run it in a profiler to find out where the performance problems (if any) are.
Is there a better way to do this than by using
reflection?Probably not, if you want to pass any arbitrary object to it.
One possible alternative is to have "XML aware" objects: define an interface WritesXML, that defines a method toXML(). You then check to see whether the given object implements this interface, and if it does you simply call the method, otherwise you use reflection.
Another alternative, assuming that your objects follow the Bean pattern, is to create "XML-ifiers" on the fly, similar to the way an app-server handles JSPs. First time you see an object you create a class that will write it to XML, then compile this class and invoke it for all subsequent objects. This will require that you have a JDK installed on the runtime machine, that the objects follow the Bean pattern, and that the number of instances of a given class are very high.
This class is going to be used by multiple batch
processes hence there will be lots of different object
types passed (they'll also be new ones in the future
that we don't even know about yet) hence my reflection
choice.Sounds like a good reason to use reflection. -
Unable to find XML document from class path resource
Hi,
I am trying to learn spring and wrote my first class today. I added all the jar files to the lib folder and created all the classes. When I try to run the client program I get
[INFO] XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [MorningGreeting.xml]
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [MorningGreeting.xml]; nested exception is java.io.FileNotFoundException: class path resource [MorningGreeting.xml] cannot be opened because it does not exist
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:180)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:148)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:73)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:61)
at com.training.spring.greetCustomers.EnterTraining.main(EnterTraining.java:22)
Exception in thread "main"
I have my client, interface, XML file all in the same package com.training.spring.greetCustomers. I could not understand what I am doing wrong?? Can you please help me.congratulations on deciding to learn spring. that's a smart thing to do.
stop assuming that you did it correctly. the xml file is not in the classpath. when you get it there correctly, spring will find it.
you have the source files and xml in that directory, but where do the .class files end up when you run them? does the xml config end up there, too?
remember, the xml config should be in the directory where the root of the package hierarchy begins, not down where the .class files are.
% -
Does anyone know of a Javascript or PHP script that will
allow a client to create new and update existing xml documents that
can be used with the Spry Dataset, through an admin area?I don't know of such a system. We do have a script that can
convert queries to XML:
http://labs.adobe.com/technologies/spry/samples/utils/query2xml.html
And I know there are PHP scripts for inserting and updating
records in a database, which might be easier.
Hope this helps,
Donald Booth
Adobe Spry Team -
XML Document object access problem?
Hi,
I have created a servlet,which will call .sh file, which will call java application.........
this java application is working as a search engine,which will do search in the XML document object...........This is working fine when only one user run this servlet...........But when more than servlet do the same it is not working......... But once first servlet create the Document object,which is main source for serching..........then second servlet will work fine.......same thing with third servlet and so on...... I used the thread.sleep()/synchronize but it is not working...bcoz i am accessing the same application.....Then instead of servlet i tried to run the java application from the Dos prompt..........But i am facing the same problem......So pl guide me bcoz everything is working excluding this..........Becoz this document object creation is taking some time........ i am creating the object shown below
Document doc =parseXmlFile("Article.xml", false);
Element docElem = doc.getDocumentElement();
public static org.w3c.dom.Document parseXmlFile(String filename, boolean validating)
try {
// Create a builder factory
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(validating);
// Create the builder and parse the file
// org.w3c.dom.Document doc = factory.newDocumentBuilder().parse(filename);
org.w3c.dom.Document doc = factory.newDocumentBuilder().parse(new File(filename));
return doc;
} catch (SAXException e) {
// A parsing error occurred; the xml input is not valid
} catch (ParserConfigurationException e) {
} catch (IOException e) {
return null;
}Hi,
This is my Servlet code..............
package PW.Feed;
import java.io.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.StreamResult;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
public class PrintDom extends HttpServlet
Document doc;
Element docElem;
Connection Conn=null;
Statement stmt=null,stmt1=null;
ResultSet rs1=null,rs=null;
PrintWriter out;
Vector myVector1=new Vector();
Vector myVector2=new Vector();
String strSql="";
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
res.setContentType("text/html");
out=res.getWriter();
try
String pubtype=req.getParameter("PubType");
String pubDate=req.getParameter("PubDate");
String toDate=req.getParameter("ToDate");
String fromDate=req.getParameter("FromDate");
if(pubDate==null)pubDate="2";
if(toDate==null)toDate="02/09/2005";
if(fromDate==null)fromDate="02/08/2005";
Class.forName("org.firebirdsql.jdbc.FBDriver");
Conn = DriverManager.getConnection("jdbc:firebirdsql:192.168.0.15/3050:D:/FBDatabases/PW1.GDB","SYSDBA","cohezia");
//Conn = DriverManager.getConnection("jdbc:firebirdsql:192.168.0.99/3050:/share/pw1.gdb","SYSDBA","cohezia");
stmt = Conn.createStatement( );
if(pubDate.equals("2"))
strSql="Select sh.ARTICLEID,sh.cuttingsdate,sh.READDATE,sh.headline,sh.SUMMARY,sh.AUTHOR,sh.PAGEFROM,sh.PUB_NAME,sh.READER_NAME,sh.PARENTTITLE,sh.CANMAIL,sh.PUBLICATION_ID,sh.JOURNALIST_ID,sh.ISPDF FROM SCANSHEADER sh,PUBLICATIONS p where sh.publication_id=p.publication_id and sh.readdate>'"+fromDate+"' and sh.readdate<'"+toDate+"' and p.pubtype='"+ pubtype +"' order by sh.ARTICLEID";
else
strSql="Select sh.ARTICLEID,sh.cuttingsdate,sh.READDATE,sh.headline,sh.SUMMARY,sh.AUTHOR,sh.PAGEFROM,sh.PUB_NAME,sh.READER_NAME,sh.PARENTTITLE,sh.CANMAIL,sh.PUBLICATION_ID,sh.JOURNALIST_ID,sh.ISPDF FROM SCANSHEADER sh,PUBLICATIONS p where sh.publication_id=p.publication_id and sh.cuttingsdate>'"+fromDate+"' and sh.cuttingsdate<'"+toDate+"' and p.pubtype='"+ pubtype +"' order by sh.ARTICLEID";
rs=stmt.executeQuery(strSql);
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
doc = builder.newDocument();
docElem = doc.createElement("RECORDLIST");
doc.appendChild(docElem);
Element rootElem = doc.createElement("RECORDS");
docElem.appendChild(rootElem);
String artid="";
while(rs.next())
Element artElem = doc.createElement("RECORD");
if((rs.getString("ARTICLEID")).length()>0)artElem.setAttribute("id",rs.getString("ARTICLEID"));
rootElem.appendChild(artElem);
Element rootFieldElem = doc.createElement("FIELDS");
artElem.appendChild(rootFieldElem);
Element eleCuttingDate = doc.createElement("FIELD");
rootFieldElem.appendChild(eleCuttingDate);
eleCuttingDate.setAttribute("fieldName","CUTTINGSDATE");
if((rs.getString("CUTTINGSDATE")).length()>0) eleCuttingDate.appendChild(doc.createTextNode(rs.getString("CUTTINGSDATE")));
Element eleReadDate = doc.createElement("FIELD");
rootFieldElem.appendChild(eleReadDate);
eleReadDate.setAttribute("fieldName","READDATE");
if((rs.getString("READDATE")).length()>0) eleReadDate.appendChild(doc.createTextNode(rs.getString("READDATE")));
Element eleHeadLine = doc.createElement("FIELD");
rootFieldElem.appendChild(eleHeadLine);
eleHeadLine.setAttribute("fieldName","HEADLINE");
if((rs.getString("HEADLINE")).length()>0) eleHeadLine.appendChild(doc.createTextNode(rs.getString("HEADLINE")));
Element eleSummary = doc.createElement("FIELD");
rootFieldElem.appendChild(eleSummary);
eleSummary.setAttribute("fieldName","SUMMARY");
if(rs.getString("SUMMARY")==null){
//out.println("String is null");
else
{eleSummary.appendChild(doc.createTextNode(rs.getString("SUMMARY")));}
Element eleAuthor = doc.createElement("FIELD");
rootFieldElem.appendChild(eleAuthor);
eleAuthor.setAttribute("fieldName","AUTHOR");
if((rs.getString("AUTHOR")).length()>0) eleAuthor.appendChild(doc.createTextNode(rs.getString("AUTHOR")));
Element elePageFrom = doc.createElement("FIELD");
rootFieldElem.appendChild(elePageFrom);
elePageFrom.setAttribute("fieldName","PAGEFROM");
if((rs.getString("PAGEFROM")).length()>0) elePageFrom.appendChild(doc.createTextNode(rs.getString("PAGEFROM")));
Element elePubName = doc.createElement("FIELD");
rootFieldElem.appendChild(elePubName);
elePubName.setAttribute("fieldName","PUBNAME");
if((rs.getString("PUB_NAME")).length()>0) elePubName.appendChild(doc.createTextNode(rs.getString("PUB_NAME")));
Element eleReaderName = doc.createElement("FIELD");
rootFieldElem.appendChild(eleReaderName);
eleReaderName.setAttribute("fieldName","READER NAME");
if((rs.getString("READER_NAME")).length()>0) eleReaderName.appendChild(doc.createTextNode(rs.getString("READER_NAME")));
Element eleParentTitle = doc.createElement("FIELD");
rootFieldElem.appendChild(eleParentTitle);
eleParentTitle.setAttribute("fieldName","PARENTTITLE");
if((rs.getString("PARENTTITLE")).length()>0)eleParentTitle.appendChild(doc.createTextNode(rs.getString("PARENTTITLE")));
Element eleCanMail = doc.createElement("FIELD");
rootFieldElem.appendChild(eleCanMail);
eleCanMail.setAttribute("fieldName","CANMAIL");
if((rs.getString("CANMAIL")).length()>0) eleCanMail.appendChild(doc.createTextNode(rs.getString("CANMAIL")));
Element elePublicationID = doc.createElement("FIELD");
rootFieldElem.appendChild(elePublicationID);
elePublicationID.setAttribute("fieldName","PUBLICATION_ID");
if((rs.getString("PUBLICATION_ID")).length()>0) elePublicationID.appendChild(doc.createTextNode(rs.getString("PUBLICATION_ID")));
Element eleJournlistID = doc.createElement("FIELD");
rootFieldElem.appendChild(eleJournlistID);
eleJournlistID.setAttribute("fieldName","JOURNALIST_ID");
if((rs.getString("JOURNALIST_ID")).length()>0) eleJournlistID.appendChild(doc.createTextNode(rs.getString("JOURNALIST_ID")));
Element eleIspdf = doc.createElement("FIELD");
rootFieldElem.appendChild(eleIspdf);
eleIspdf.setAttribute("fieldName","ISPDF");
if((rs.getString("ISPDF")).length()>0) eleIspdf.appendChild(doc.createTextNode(rs.getString("ISPDF")));
Element rootKeyElem=doc.createElement("KEYWORDS_CODES");
String[] arrCodes=getKeyCodes(rs.getString("ARTICLEID"));
int count1 = myVector1.size();
String[] myArray1=new String[count1];
myVector1.copyInto(myArray1);
int count2 = myVector2.size();
String[] myArray2=new String[count2];
myVector2.copyInto(myArray2);
for(int j=0;j<arrCodes.length;j++)
Element eleKeyword= doc.createElement("KEYWORD_CODE");
eleKeyword.setAttribute("CodeId",arrCodes[j]);
eleKeyword.setAttribute("LongName",myArray1[j]);
eleKeyword.setAttribute("CodeType",myArray2[j]);
rootKeyElem.appendChild(eleKeyword);
artElem.appendChild(rootKeyElem);
Source source = new DOMSource(docElem);
//File file = new File("/share/PrintDom.xml");
StringWriter rw=new StringWriter();
Result result = new StreamResult(rw);
//Result result = new DOMResult();
// Write the DOM document to the file
Transformer xformer = TransformerFactory.newInstance().newTransformer();
xformer.transform(source, result);
out.println(rw);
catch (ClassNotFoundException e)
out.println("Unable to load Driver Class" + e);
return;
//fileLog.log(e,"PressWatchFrame1.PressWatchFrame1()");
catch (SQLException se)
out.println(se);
catch (Exception e)
out.println(e);
finally{
try{
if(Conn!=null) Conn.close();
catch(SQLException ignored){}
public String[] getKeyCodes(String strArticleId)
Vector myVector=new Vector();
myVector1.removeAllElements();
myVector2.removeAllElements();
try{
stmt1=Conn.createStatement( );
//String strSql1="Select codeid FROM SCANSSUBJECT where articleid='"+ strArticleId +"'";
String strSql1="Select ss.codeid,c.longname,c.codetype FROM SCANSSUBJECT ss,CODES c where ss.codeid=c.codeid and articleid='"+ strArticleId +"'";
rs1=stmt1.executeQuery(strSql1);
String strCodes="";
while(rs1.next())
myVector.add(rs1.getString("codeid"));
myVector1.add(rs1.getString("longname"));
myVector2.add(rs1.getString("codetype"));
}catch (SQLException se)
out.println(se);
int count = myVector.size();
String[] myArray = new String[count];
myVector.copyInto(myArray);
return myArray;
..................Thanx -
I tested my procedure for upgrading from OBI 11.1.1.5 to 11.1.1.6 which was successful. I had to rollback to OBI 11.1.1.5 using my database backup and VM snapshot due to project requirements.
The OBI application successfully comes up but users who login just get "Error loading XML Document from /analytics/saw.dll/common/privileges.xml?fmapID=KqIJCw. The response given was: ". They can't close this message box so are unable to do anything.
How can I fix this?Hi All,
You can face this issue with other versions of OBIEE 11.*
Problem cab be solved as follows:
Go to http://localhost:7001/em > coreapplication > Capacity Management > Scalibility >
1. Lock and edit
2 .increase number of presentation services to 2
3. restart opmn component.
Go to coreapplication > Availibility > processes
1 .please note that in deployment > catalog > change path of catalog field from $coreapplication to path where your catalog resides.
2. Take down your primary instance.
3. As your secondary is up, it will grant you to browse you through catalog and dashboards.
If you want to run primary instance of presentation services
Go to path \Middleware\instances\instance1\bifoundation\OracleBIPresentationServicesComponent\coreapplication_obips2
except catalog and catalog manager > Copy all other files to coreapplication_obips1
restart opmn component > problem solved.!!!
Regards,
Akshay S.
please like if you find it helpful -
There is an error in XML document - TimeStamp
Hi All,
Hope you can help. Captivate has been working great so far on our LMS. But since moving to Captivate 7 when submitting we get the below problem,
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>System.Web.Service s.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (2, 1250). ---> System.FormatException: The string '2013-07-24T16:30:41.0+02' is not a valid AllXsd value.
at System.Xml.Schema.XsdDateTime..ctor(String text, XsdDateTimeFlags kinds)
at System.Xml.XmlConvert.ToDateTime(String s, XmlDateTimeSerializationMode dateTimeOption)
at System.Xml.Serialization.XmlCustomFormatter.ToDateTime(String value)
at System.Xml.Serialization.XmlSerializationReader.ToDateTime(String value)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read19_interactionT ype(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read20_interactions Type(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read32_cocdType(Boo lean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read34_RteDataModel Type(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read36_Commit(Boole an isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read41_Commit()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer4.Deserialize(XmlSer ializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
--- End of inner exception stack trace ---
at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()</faultstring><detail /></soap:Fault></soap:Body></soap:Envelope>
Is this a problem possibly between the editions of SCORM or is it something in the Captivate product? Perhaps the xml parser version?Thanks,
I have tested on SCORM Cloud and it is working... The SCORM content has been published with 2004 3rd edition.
We are making use of the Icodeon SCORM player (integrate with Signify LMS), do you perhaps think it could be something on the SCORM player then? -
Performance issues with FDK in large XML documents
In my current project with FrameMaker 8 I'm experiencing severe performance issues with some FDK API calls.
The documents are about 3-8 MBytes in size. Fortmatted they cover 150-250 pages.
When importing such an XML document I do some extensive "post-processing" using FDK. This processing happens in Sr_EventHandler() during the SR_EVT_END_READER event. I noticed that some FDK functions calls which modify the document's structure, like F_ApiSetAttribute() or F_ApiNewElementInHierarchy(), take several seconds, for the larger documents even minutes, to complete one single function call. I tried to move some of these calls to earlier events, mostly to SR_EVT_END_ELEM. There the calls work without a delay. Unfortunately I can't rewrite the FDK client to move all the calls that are lagging to earlier events.
Does anybody have a clue why such delays happen, and possibly can make a suggestion, how to solve this issue? Thank you in advance.
PS: I already thought of splitting such a document in smaller pieces by using the FrameMaker book function. But I don't think, the structure of the documents will permit such an automatic split, and it definitely isn't an option to change the document structure (the project is about migrating documents from Interleaf to XML with the constraint of keeping the document layout identical).FP_ApplyFormatRules sounds really good--I'll give it a try on Monday. Wonder how I could miss it, as I already tried FP_Reformatting and FP_Displaying at no avail?! By the way, what is actually meant with FP_Reformatting (when I used it I assumed it would do exactly what FP_ApplyFormatRules sounds to do), or is that one another of Lynne's well-kept secrets?
Thank's for all the helpful suggestions, guys. On Friday I already had my first improvements in a test version of my client: I did some (not all necessary) structural changes using XSLT pre-processing, and processing went down from 8 hours(!) to 1 hour--Yeappie! I was also playing with the idea of writing a wrapper to F_ApiNewElementInHierarchy() which actually pastes an appropriate element created in a small flow on the reference pages at the intended insertion location. But now, with FP_ApplyFormatRules on the horizon, I'm quite confident to get even the complicated stuff under control, which cannot be handled by the XSLT pre-processing, as it is based on the actual formatting of the document at run-time and cannot be anticipated in pre-processing.
--Franz -
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.
RgrdsHere 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. -
ClassCastException while creating an XML document in servlet
HI,
I am trying to create an XML document in a servlet and I am getting ClassCastException at runtime when casting org.w3c.dom.document to org.apache.crimson.tree.XmlDocument . I am using Tomcat 4.1
The same code is working fine when executed in a stand alone java program
Can anyone please help me in trying to solve this problem. I require it urgently.
The following is my code:
import java.io.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.apache.crimson.tree.XmlDocument;
public class test{
public void createxml (String username) throws Exception
Document doc=null;
DocumentBuilderFactory dbf=null;
DocumentBuilder db=null;
Element root=null;
Element poline=null;
org.apache.crimson.tree.XmlDocument xmldoc=null;
FileOutputStream fos=null;
dbf = DocumentBuilderFactory.newInstance ();
db = dbf.newDocumentBuilder ();
doc = db.newDocument ();
root = doc.createElement ("album");
doc.appendChild (root);
poline= doc.createElement("album-name");
root.appendChild(poline);
//I am getting the ClassCastException in this statement
xmldoc = (XmlDocument) doc;
fos = new java.io.FileOutputStream("xyz.xml");
xmldoc.write(fos);
fos.close();
}I am not too much of an expert on this issue, but I did a search. Maybe this page can help or point you in the right direction.
http://www.jspwiki.org/Wiki.jsp?page=A2AClassCastException
I hope this helps. -
Validating an XML document to a schema using ColdFusion
This is something I have never tried before. We created an XML Schema to define XML documents we expect to receive from various entities. When we receive the document, we would like to validate it before processing it. I think ColdFusion is up to this from reading the documentation, but we have not got anything working yet.
When we try and xmlParse() our test XML file against the XML schema we get the following error. When we use a web based XML validation tool and feed it the same XML file and schema it validates just fine.
An error occured while parsing an XML document.
[Error] :2:6: cvc-elt.1: Cannot find the declaration of element 'pur'.
The error occurred in D:\playground\warren\ppur_file_import.cfm: line 57
55 :
56 :
57 : <cfset xmldoc = XmlParse(ExpandPath(filepath), true, ExpandPath(validator)) />
58 : <cfdump var="#xmldoc#">
59 : <cfabort>
Searching for the error has not provided me any useful hints. Can anybody here?XML SCHEMA
<?xml version="1.0" encoding="iso-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Simple Types -->
<xs:simpleType name="RECORD_ID">
<xs:restriction base="xs:string">
<xs:pattern value="[AaBbCc]"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="REPORT_MONTH">
<xs:restriction base="xs:integer">
<xs:pattern value="(0[1-9]|1[0-2])"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="REPORT_YEAR">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{2}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="MFG_FIRMNO">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{7}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="LABEL_SEQ_NO">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{5}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="REVISION_NO">
<xs:restriction base="xs:string">
<xs:pattern value="[A-Za-z]{2}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="REG_FIRMNO">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{7}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="GROWER_ID">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{11}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="CEDTS_IND">
<xs:restriction base="xs:string">
<xs:pattern value="[Ee]|[ ]"/>
<!-- needs to match E or a blank. -->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="APPLIC_DT">
<xs:restriction base="xs:integer">
<xs:pattern value="(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])([0-9]{2})"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SITE_CODE">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{6}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="QUALIFY_CD">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{2}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="PLANTING_SEQ">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ACRE_TREATED">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{8}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="UNIT_TREATED">
<xs:restriction base="xs:string">
<xs:pattern value="[ATSCKUPatsckup]"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="AMT_PRD_USED">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{10}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="UNIT_OF_MEAS">
<xs:restriction base="xs:string">
<xs:pattern value="LB|OZ|GA|QT|PT|KG|GR|LI|ML"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="DOCUMENT_NO">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{8}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="LINE_ITEM">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{4}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="PROCESS_DT">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{4}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="BATCH_NO">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-5][0-9][0-9][0-9]"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="COUNTY_CD">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-5][0-9]"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SECTION">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{2}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TOWNSHIP">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{2}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TSHIP_DIR">
<xs:restriction base="xs:string">
<xs:pattern value="[NSns]"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="RANGE">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{2}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="RANGE_DIR">
<xs:restriction base="xs:string">
<xs:pattern value="[EWew]"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="BASE_LN_MER">
<xs:restriction base="xs:string">
<xs:pattern value="[HMShms]"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="AER_GND_IND">
<xs:restriction base="xs:string">
<xs:pattern value="[AFGOafgo]"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SITE_LOC_ID">
<xs:restriction base="xs:string">
<xs:pattern value="[-0-9 ]+"/>
<!-- Examples in files I checked
only had numeric characters and
a dash. The county contract doesn't
specify numeric-only, so letters may
be acceptable. I find no evidence of
any letters being used. -->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ACRE_PLANTED">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{8}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="UNIT_PLANTED">
<xs:restriction base="xs:string">
<xs:pattern value="[ATSCKUPatsckup]"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="APPLIC_TM">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{4}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="APPLIC_CNT">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{6}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="FUME_CD">
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{4}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="LICENSE_NO">
<xs:restriction base="xs:integer">
<xs:pattern value="[-0-9A-Za-z]{13}"/>
</xs:restriction>
</xs:simpleType>
<!-- end Simple Types -->
<!-- !!!!!!!!! Begin Abstract Types !!!!!!!!! -->
<xs:complexType name="application_data_abs" abstract="true">
<xs:sequence>
<xs:element name="GROWER_ID" type="GROWER_ID" />
<xs:element name="CEDTS_IND" type="CEDTS_IND" />
<xs:element name="APPLIC_DT" type="APPLIC_DT" />
<xs:element name="SITE_CODE" type="SITE_CODE" />
<xs:element name="QUALIFY_CD" type="QUALIFY_CD" />
<xs:element name="PLANTING_SEQ" type="PLANTING_SEQ" />
<xs:element name="ACRE_TREATED" type="ACRE_TREATED" />
<xs:element name="UNIT_TREATED" type="UNIT_TREATED" />
<xs:element name="AMT_PRD_USED" type="AMT_PRD_USED" />
<xs:element name="UNIT_OF_MEAS" type="UNIT_OF_MEAS" />
<xs:element name="DOCUMENT_NO" type="DOCUMENT_NO" />
<xs:element name="LINE_ITEM" type="LINE_ITEM" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="application_abs" abstract="true">
<xs:sequence>
<xs:element name="key_data" type="key_data" />
<xs:element name="product_data" type="product_data" />
</xs:sequence>
</xs:complexType>
<!-- !!!!!!!!! End Abstract Types !!!!!!!!! -->
<!-- !!!!!!!!! Start Complex Types !!!!!!!!! -->
<xs:complexType name="product_data">
<xs:sequence>
<xs:element name="MFG_FIRMNO" type="MFG_FIRMNO" />
<xs:element name="LABEL_SEQ_NO" type="LABEL_SEQ_NO"/>
<xs:element name="REVISION_NO" type="REVISION_NO" />
<xs:element name="REG_FIRMNO" type="REG_FIRMNO" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="key_data">
<xs:sequence>
<xs:element name="RECORD_ID" type="RECORD_ID" />
<xs:element name="COUNTY_KEY">
<!--
The optional COUNTY_ID field would be used by
the Counties to include their internal
record identifier. This would allow DPR
to reference a county's internal record ID
in the event of data inconsistencies.
-->
</xs:element>
<xs:element name="REPORT_MONTH" type="REPORT_MONTH" />
<xs:element name="REPORT_YEAR" type="REPORT_YEAR" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="fileInfo">
<xs:sequence>
<xs:element name="PROCESS_DT" type="PROCESS_DT" />
<xs:element name="BATCH_NO" type="BATCH_NO" />
<xs:element name="COUNTY_CD" type="COUNTY_CD" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="mtrs_data">
<xs:sequence>
<xs:element name="SECTION" type="SECTION" />
<xs:element name="TOWNSHIP" type="TOWNSHIP" />
<xs:element name="TSHIP_DIR" type="TSHIP_DIR" />
<xs:element name="RANGE" type="RANGE" />
<xs:element name="RANGE_DIR" type="RANGE_DIR" />
<xs:element name="BASE_LN_MER" type="BASE_LN_MER" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="ag_application_data">
<xs:complexContent>
<xs:extension base="application_data_abs">
<xs:sequence>
<xs:element name="AER_GND_IND" type="AER_GND_IND" />
<xs:element name="SITE_LOC_ID" type="SITE_LOC_ID" />
<xs:element name="ACRE_PLANTED" type="ACRE_PLANTED" />
<xs:element name="UNIT_PLANTED" type="UNIT_PLANTED" />
<xs:element name="APPLIC_TM" type="APPLIC_TM" />
<xs:element name="FUME_CD" type="FUME_CD" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="nonag_application_data">
<xs:complexContent>
<xs:extension base="application_data_abs">
<xs:sequence>
<xs:element name="APPLIC_CNT" type="APPLIC_CNT" />
<xs:element name="LICENSE_NO" type="LICENSE_NO" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!--- "Ag" -->
<!--
Type A:
Data that would appear on individual lines
in the old A type
(F file type, agricultural job report)
Type B:
Data that would appear on individual lines
in the old B type
(F file type, agricultural monthly production summary)
-->
<xs:complexType name="ag_application">
<xs:complexContent>
<xs:extension base="application_abs">
<xs:sequence>
<xs:element name="mtrs_data" type="mtrs_data" />
<xs:element name="application_data" type="ag_application_data" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!--- "Non_Ag" -->
<!--
Data that would appear on individual lines
in the old C type
(C file type, non-agricultural monthly summary)
-->
<xs:complexType name="nonag_application">
<xs:complexContent>
<xs:extension base="application_abs">
<xs:sequence>
<xs:element name="application_data" type="nonag_application_data" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- The individual lines of data that are transmitted. -->
<xs:complexType name="data_lines">
<xs:sequence>
<xs:element name="Non_Ag" type="nonag_application" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Ag" type="ag_application" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- !!!!!!!!! End Complex Types !!!!!!!!! -->
<xs:element name="pur">
<xs:complexType>
<xs:sequence>
<xs:element name="County" minOccurs="0" maxOccurs="1">
<!--
Tag for counties to put county-specific
data in (eg, their batch number, timestamp,
contact info, etc)
-->
</xs:element>
<!-- File: information specific to the file -->
<xs:element name="File" type="fileInfo" minOccurs="1" maxOccurs="1"/>
<!-- Data: lines of data transmitted -->
<xs:element name="Data" type="data_lines" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Maybe you are looking for
-
Moving personalization from one instance to another.
Hi All, Could anyone guide me with the steps of moving personalizations from one istance to another.. I tried this syntax.. FNDLOAD <userid>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/affrmcus.lct <filename.ldt> FND_FORM_CUSTOM_RULES form_name
-
Plugging in iPod deletes my mac's Documents
I have a 5th generation iPod classic and a 2006 black macbook running Leopard. I am in college and thus don't live at home, but my iPod's library is synced to the iTunes library of my home computer, which is a PC. I forgot my charger when I last came
-
The real question I guess is: Would my apple TV be able to read music or movie files on its own on my external hard drive plugged into my Airport Extreme without iTunes running on my computer? And a second question: Can iTunes on my PC manage and rea
-
Transfering playlists between libraries
Is there a way to transfer ONLY the playlist information between libraries? I recently created a new iTunes library on an external drive, and then consolidated all of the music I had scattered in various libraries and other locations on this external
-
Why can I download and install all of the Oracle ATS products for free?
Why can I download and install all of the Oracle ATS products for free? When I installed, I was not prompted for any licenses or to purchase anything. I want to know why this is possible and if there are plans to charge for it in the future?