Auto-generate ${uuid} with same value in 2 places
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 168
- Joined: Fri Feb 28, 2020 4:02 pm
Auto-generate ${uuid} with same value in 2 places
Post by vishwavaranasi »
Hello Team ,
We have our custom doc templates where set a custom id to new topics , I do that using addCustomEditorVariablesResolver function based on this
code :https://github.com/digicademy/CustomUUI ... nsion.java.
this works fine where every time when we creat new topic the new UUID generated and assigned as id.
here we have another requirement , we wanted the same UUID to placed for title
and the title is something should always starts with TITLE_${customUUID}
so here topic id is F503DC44-9A8F-4043-92D1-6B95CD92D003
then title id we need TITLE_F503DC44-9A8F-4043-92D1-6B95CD92D003 (same UUID)
would you please help us here.
We have our custom doc templates where set a custom id to new topics , I do that using addCustomEditorVariablesResolver function based on this
code :https://github.com/digicademy/CustomUUI ... nsion.java.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//COMPANY//DTD myCustom DITA Topic//EN" "myCustomTopic.dtd">
<topic id="${customUUID}" format="dita" type="topic">
<title></title>
<body></body>
</topic>
here we have another requirement , we wanted the same UUID to placed for title
and the title is something should always starts with TITLE_${customUUID}
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//COMPANY//DTD myCustom DITA Topic//EN" "myCustomTopic.dtd">
<topic id="${customUUID}" format="dita" type="topic">
<title id="TITLE_${customUUID}"></title>
<body></body>
</topic>
then title id we need TITLE_F503DC44-9A8F-4043-92D1-6B95CD92D003 (same UUID)
would you please help us here.
Thanks,
vishwa
vishwa
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Auto-generate ${uuid} with same value in 2 places
Hi,
You control how the UUID is generated in the Java code, there is nothing stopping you to do this for example:
Regards,
Radu
You control how the UUID is generated in the Java code, there is nothing stopping you to do this for example:
Code: Select all
public String resolveEditorVariables(String contentWithEditorVariables, String currentEditedFileURL){
//Generate the uuid value only once, and then use it in all places in the content string.
String value = createCustomUUID().toString();
return contentWithEditorVariables.replaceAll("\\$\\{stableCustomUUID\\}", value);
}
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service