chore(refactor): commit current refactor branch updates and slice1 xml/form derivation extraction
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
import xpath from "xpath";
|
||||
|
||||
export const parseXml = (xmlStr) => {
|
||||
const parser = new DOMParser();
|
||||
return parser.parseFromString(xmlStr, "text/xml");
|
||||
};
|
||||
|
||||
export const selectCurrentSectionTitleDescriptions = (doc, currentSection) => {
|
||||
return xpath.select(
|
||||
"//form/tabs/tab[" + currentSection + " ]/labels/label/@description",
|
||||
doc
|
||||
);
|
||||
};
|
||||
|
||||
export const selectCurrentSectionRows = (doc, currentSection) => {
|
||||
return xpath.select(
|
||||
"/form/tabs/tab[" +
|
||||
currentSection +
|
||||
"]/columns//sections/section/rows/row",
|
||||
doc
|
||||
);
|
||||
};
|
||||
|
||||
export const selectFormTabs = (doc) => {
|
||||
return xpath.select("/form/tabs", doc);
|
||||
};
|
||||
|
||||
export const selectAllTabTitleDescriptions = (doc) => {
|
||||
return xpath.select("//form/tabs/tab[*]/labels/label/@description", doc);
|
||||
};
|
||||
|
||||
export const parseRowOuterHTML = (outerHTML) => {
|
||||
const parser = new DOMParser();
|
||||
return parser.parseFromString(outerHTML, "text/xml");
|
||||
};
|
||||
|
||||
export const selectRowLabelDescriptions = (doc) => {
|
||||
return xpath.select("//label/@description", doc);
|
||||
};
|
||||
|
||||
export const selectRowFieldType = (doc) => {
|
||||
return xpath.select("//@classid", doc);
|
||||
};
|
||||
|
||||
export const selectRowValidation = (doc) => {
|
||||
return xpath.select("//@validation", doc);
|
||||
};
|
||||
|
||||
export const selectRowMaxFieldLength = (doc) => {
|
||||
return xpath.select("//@maxFieldLength", doc);
|
||||
};
|
||||
|
||||
export const selectRowMaxSubField = (doc) => {
|
||||
return xpath.select("//@maxsubfield", doc);
|
||||
};
|
||||
|
||||
export const selectRowDataFieldName = (doc) => {
|
||||
return xpath.select("//@datafieldname", doc);
|
||||
};
|
||||
|
||||
export const selectRowDataFieldContent = (doc) => {
|
||||
return xpath.select("//@datafieldcontent", doc);
|
||||
};
|
||||
|
||||
export const selectRowParentField = (doc) => {
|
||||
return xpath.select("//@parentField", doc);
|
||||
};
|
||||
|
||||
export const selectRowParentFieldShowOnValue = (doc) => {
|
||||
return xpath.select("//@parentFieldShowOnValue", doc);
|
||||
};
|
||||
|
||||
export const selectRowRequiredDocumentValue = (doc) => {
|
||||
return xpath.select("//@requiredDocumentValue", doc);
|
||||
};
|
||||
|
||||
export const selectRowRequiredDocumentLabel = (doc) => {
|
||||
return xpath.select("//@requiredDocumentLabel", doc);
|
||||
};
|
||||
|
||||
export const selectRowDocumentTypeCode = (doc) => {
|
||||
return xpath.select("//@ishareDocumentCode", doc);
|
||||
};
|
||||
|
||||
export const selectRowHint = (doc) => {
|
||||
return xpath.select("//label/@hint", doc);
|
||||
};
|
||||
|
||||
export const selectRowDateStart = (doc) => {
|
||||
return xpath.select("//@dateStart", doc);
|
||||
};
|
||||
|
||||
export const selectRowDateEnd = (doc) => {
|
||||
return xpath.select("//@dateEnd", doc);
|
||||
};
|
||||
|
||||
export const selectErrorFieldLabelDescription = (doc, whichField) => {
|
||||
return xpath.select(
|
||||
"//*[control/@id='" + whichField + "']//@description",
|
||||
doc
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user